diff --git a/src/backends/packrat.c b/src/backends/packrat.c
index b03d6a365c5e06cc566c97078e2a8bde6397e5a0..864d131f8ac3edd6a14fdf800fc84932b5ca99d7 100644
--- a/src/backends/packrat.c
+++ b/src/backends/packrat.c
@@ -1,4 +1,6 @@
 #include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include "../internal.h"
 #include "../parsers/parser_internal.h"
@@ -131,8 +133,10 @@ HParseResult* grow(HParserCacheKey *k, HParseState *state, HRecursionHead *head)
   // Store the head into the recursion_heads
   h_hashtable_put(state->recursion_heads, &k->input_pos, head);
   HParserCacheValue *old_cached = h_hashtable_get(state->cache, k);
-  if (!old_cached || PC_LEFT == old_cached->value_type)
+  if (!old_cached || PC_LEFT == old_cached->value_type) {
     fprintf(stderr, "impossible match");
+    exit(1);
+  }
   HParseResult *old_res = old_cached->right;
 
   // rewind the input
@@ -155,6 +159,7 @@ HParseResult* grow(HParserCacheKey *k, HParseState *state, HRecursionHead *head)
 	return cached->right;
       } else {
 	fprintf(stderr, "impossible match");
+        exit(1);
       }
     }
   } else {
@@ -180,6 +185,7 @@ HParseResult* lr_answer(HParserCacheKey *k, HParseState *state, HLeftRec *growab
     }
   } else {
     fprintf(stderr, "lrAnswer with no head");
+    exit(1);
   }
 }
 
diff --git a/src/benchmark.c b/src/benchmark.c
index c2cc5b513042b26bbf2e98ab2ba5f93770dde13f..c35a39ea907ce080812bb8798e4fc4d7f64dc84f 100644
--- a/src/benchmark.c
+++ b/src/benchmark.c
@@ -225,7 +225,7 @@ void h_benchmark_report(FILE* stream, HBenchmarkResults* result) {
       fprintf(stream, "Skipping %s because grammar did not compile for it\n", HParserBackendNames[i]);
     } else {
 #ifndef _MSC_VER
-      errx(stream, "Backend %zd (%s) ... \n", i, HParserBackendNames[i]);
+      fprintf(stream, "Backend %zd (%s) ... \n", i, HParserBackendNames[i]);
 #else
 	  fprintf(stream, "Backend %u (%s) ... \n", i, HParserBackendNames[i]);
 #endif
@@ -235,7 +235,7 @@ void h_benchmark_report(FILE* stream, HBenchmarkResults* result) {
         continue;
       }
 #ifndef _MSC_VER
-	  errx(stream, "Case %zd: %zd ns/parse, %zd ns/byte\n", j, result->results[i].cases[j].parse_time, result->results[i].cases[j].parse_time / result->results[i].cases[j].length);
+	  fprintf(stream, "Case %zd: %zd ns/parse, %zd ns/byte\n", j, result->results[i].cases[j].parse_time, result->results[i].cases[j].parse_time / result->results[i].cases[j].length);
 #else
 	  fprintf(stream, "Case %u: %u ns/parse, %u ns/byte\n", j, result->results[i].cases[j].parse_time, result->results[i].cases[j].parse_time / result->results[i].cases[j].length);
 #endif
diff --git a/src/internal.h b/src/internal.h
index 6ffc80d3133ae4b3f34ab24795a1f32e29f21323..73e9d0f1aa0f3762cfe64f18d2221b1672691ad3 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -63,10 +63,10 @@ static __inline void h_generic_free(HAllocator *allocator, void* ptr) {
   allocator->free(allocator, ptr);
 }
 
-#if COMPILING_DLL
-#define DLLEXPORT
+#if defined _MSC_VER && !defined COMPILING_DLL
+# define DLLEXPORT __declspec(dllimport)
 #else
-#define DLLEXPORT __declspec(dllimport)
+# define DLLEXPORT
 #endif
 
 extern DLLEXPORT HAllocator system_allocator;