diff --git a/src/helper/fileio.h b/src/helper/fileio.h
index 36e749b26c3ea5aefcc5a37c8d46f6b07667dcfa..e62f0ba8e488256f722482c67f92f1dfe1ab7ccf 100644
--- a/src/helper/fileio.h
+++ b/src/helper/fileio.h
@@ -26,9 +26,9 @@
 #ifndef FILEIO_H
 #define FILEIO_H
 
-#define FILEIO_MAX_ERROR_STRING		(128)
+#include "types.h"
 
-#include "replacements.h"
+#define FILEIO_MAX_ERROR_STRING		(128)
 
 enum fileio_type
 {
diff --git a/src/helper/jim-eventloop.c b/src/helper/jim-eventloop.c
index d53a76db40d9e0db2110670a3c0a52cda4c8d08d..7524d39fd03d96234104ac558f6be9a9d2f72aea 100644
--- a/src/helper/jim-eventloop.c
+++ b/src/helper/jim-eventloop.c
@@ -61,11 +61,6 @@
 #include "jim-eventloop.h"
 #endif
 
-#include "replacements.h"
-
-
-/* --- */
-
 /* File event structure */
 typedef struct Jim_FileEvent {
     void *handle;
diff --git a/src/helper/jim.c b/src/helper/jim.c
index e344ef590cb1a393a249b256f144a7dc54ff0454..261b86029dcb2ccf2aec93d0021e498e46484291 100644
--- a/src/helper/jim.c
+++ b/src/helper/jim.c
@@ -56,8 +56,6 @@
 #include <stdarg.h>
 #include <limits.h>
 
-#include "replacements.h"
-
 /* Include the platform dependent libraries for
  * dynamic loading of libraries. */
 #ifdef JIM_DYNLIB
diff --git a/src/helper/log.h b/src/helper/log.h
index 4f781991c257dd5221674052ac6d6db7de688ce8..1a032b26151171b670ab80dd713387083394cb30 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -26,7 +26,6 @@
 #ifndef ERROR_H
 #define ERROR_H
 
-#include "replacements.h"
 #include "command.h"
 
 /* logging priorities 
diff --git a/src/helper/replacements.c b/src/helper/replacements.c
index cc0c242aeac5c1d64e3bcc6edea4f3c894dc717e..6b367fa8437a1bcbc17b67d150df37d56fe6b4a5 100644
--- a/src/helper/replacements.c
+++ b/src/helper/replacements.c
@@ -23,17 +23,10 @@
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 /* DANGER!!!! These must be defined *BEFORE* replacements.h and the malloc() macro!!!! */
 
 #include <stdlib.h>
 #include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
 /* 
  * clear_malloc
  *
@@ -65,9 +58,12 @@ void *fill_malloc(size_t size)
 }
 
 #define IN_REPLACEMENTS_C
-#include "replacements.h"
-
-#include <stdio.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
 
 #ifdef _WIN32
 #include <io.h>
diff --git a/src/helper/replacements.h b/src/helper/replacements.h
index 34e5daa44fd209ef4e0137c1373583146567f286..7ecbbb22014621fb0caae5bc7d914ac3564c641a 100644
--- a/src/helper/replacements.h
+++ b/src/helper/replacements.h
@@ -26,8 +26,6 @@
 #ifndef REPLACEMENTS_H
 #define REPLACEMENTS_H
 
-#include "types.h"
-
 /* MIN,MAX macros */
 #ifndef MIN
 #define MIN(a,b) (((a)<(b))?(a):(b))
diff --git a/src/target/algorithm.c b/src/target/algorithm.c
index a3672b201bb35d9f09fbbb89e229162415d06e3b..664aeb276ce89b7f48786534ae6a34b060840ab6 100644
--- a/src/target/algorithm.c
+++ b/src/target/algorithm.c
@@ -22,7 +22,6 @@
 #endif
 
 #include "algorithm.h"
-#include "replacements.h"
 #include "binarybuffer.h"
 
 
diff --git a/src/target/target.h b/src/target/target.h
index a664dc34bcb0a007bd09c559045d62c5dc8f4bed..4a6dde1addc88a0860a0d627394ee09436365539 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -30,8 +30,6 @@
 #include "algorithm.h"
 #include "command.h"
 
-#include "replacements.h"
-
 struct reg_s;
 struct trace_s;
 struct command_context_s;