diff --git a/bntseq.c b/bntseq.c
index 98a5a494..adcd2d78 100644
--- a/bntseq.c
+++ b/bntseq.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <zlib.h>
+#include <unistd.h>
 #include "bntseq.h"
 #include "main.h"
 #include "utils.h"
diff --git a/bwtsw2_aux.c b/bwtsw2_aux.c
index 5d57ba85..4ac11fdb 100644
--- a/bwtsw2_aux.c
+++ b/bwtsw2_aux.c
@@ -574,7 +574,7 @@ static void bsw2_aln_core(bsw2seq_t *_seq, const bsw2opt_t *_opt, const bntseq_t
 			rseq[1][i] = c;
 		}
 		if (l - k < opt.t) { // too few unambiguous bases
-			buf[x] = 0;
+			buf[x] = calloc(1, sizeof(bwtsw2_t));
 			free(seq[0]); continue;
 		}
 		// alignment
diff --git a/main.c b/main.c
index 3e9a6d48..d15d14ff 100644
--- a/main.c
+++ b/main.c
@@ -4,7 +4,7 @@
 #include "utils.h"
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.6.0-r85"
+#define PACKAGE_VERSION "0.6.0-r89-dev"
 #endif
 
 static int usage()