diff --git a/Makefile b/Makefile
index 856eb33..f69d6aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-ROOTDIR=.
+TROOT=.
 include Makefile.inc
 
 
diff --git a/Makefile.inc b/Makefile.inc
index ae2fa3f..22f0282 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -2,11 +2,11 @@
 # when included in src/*/Makefile then it builds a binary locally
 # when included in ./Makefile then all tests are linked into one binary
 
-ROOTDIR ?= ../..
-ifeq ($(ROOTDIR), .)
-SRCS = $(sort $(wildcard src/*/*.c))
+TROOT ?= ../..
+ifeq ($(TROOT), .)
+SRCS ?= $(sort $(wildcard src/*/*.c))
 else
-SRCS = $(sort $(wildcard *.c))
+SRCS ?= $(sort $(wildcard *.c))
 endif
 OBJS = $(SRCS:.c=.o)
 
@@ -20,9 +20,9 @@ RANLIB=ranlib
 
 CFLAGS += -g -D_POSIX_C_SOURCE=200809L -std=c99 -pipe -Wall
 LDFLAGS += -g -lpthread -lrt -lm
-INC += -I$(ROOTDIR)/common
+INC += -I$(TROOT)/common
 
--include $(ROOTDIR)/Makefile.conf
+-include $(TROOT)/Makefile.conf
 
 ifeq ($(usemusl), yes)
 CC=gcc
@@ -33,15 +33,16 @@ LDFLAGS += -nostdlib -Wl,-e,_start,-Bstatic $(libdir)/crti.o $(libdir)/crt1.o $(
 INC     += -isystem $(includedir)
 endif
 
-all: t b
+test: t b
+	./t
 
 clean:
-	rm -f $(OBJS) t t.o b b.o tests.a tests.h
+	rm -f $(OBJS) t t_.o b b_.o tests.a tests.h
 
 .c.o:
 	$(CC) $(CFLAGS) $(INC) -c -o $@ $<
 
-$(OBJS): $(ROOTDIR)/common/test.h $(ROOTDIR)/Makefile.conf
+$(OBJS): $(TROOT)/common/test.h $(TROOT)/Makefile.conf
 
 tests.h: $(OBJS)
 	nm -f posix $+ |awk ' \
@@ -53,16 +54,17 @@ tests.a: $(OBJS)
 	$(AR) rc $@ $+
 	$(RANLIB) $@
 
-t.o: $(ROOTDIR)/common/t.c $(ROOTDIR)/common/test.h tests.h
+# TODO: /tmp/t.o ?
+t_.o: $(TROOT)/common/t.c $(TROOT)/common/test.h tests.h
 	$(CC) $(CFLAGS) $(INC) -I. -c -o $@ $<
 
-t: t.o tests.a
+t: t_.o tests.a
 	$(CC) $+ $(LDFLAGS) -o $@
 
-b.o: $(ROOTDIR)/common/b.c $(ROOTDIR)/common/test.h tests.h
+b_.o: $(TROOT)/common/b.c $(TROOT)/common/test.h tests.h
 	$(CC) $(CFLAGS) $(INC) -I. -c -o $@ $<
 
-b: b.o tests.a
+b: b_.o tests.a
 	$(CC) $+ $(LDFLAGS) -lrt -o $@
 
 .PHONY: all clean
diff --git a/src/stdio/bench.c b/src/stdio/bench.c
index 95f9b90..0e87845 100644
--- a/src/stdio/bench.c
+++ b/src/stdio/bench.c
@@ -3,6 +3,22 @@
 #include <string.h>
 #include "test.h"
 
+void bench_stdio_getc_unlocked(int N) {
+	FILE *f = tmpfile();
+	size_t i;
+	size_t cs = 0;
+
+	for (i=0; i<N; i++)
+		putc('x', f);
+	fseeko(f, 0, SEEK_SET);
+	reset_timer();
+	for (i=0; i<N; i++)
+		cs += getc_unlocked(f);
+	fclose(f);
+	if (cs != (size_t)N*'x')
+		abort();
+}
+
 void bench_stdio_putcgetc(int N) {
 	FILE *f = tmpfile();
 	size_t i;
diff --git a/src/stdio/fscanf.c b/src/stdio/fscanf.c
index 1de09c3..d5da238 100644
--- a/src/stdio/fscanf.c
+++ b/src/stdio/fscanf.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
@@ -18,6 +19,18 @@ static void S(const char *s, const char *x, const char *m) {
 		error("got [%s], expected [%s] (%s)\n", s, x, m);
 }
 
+void test_scanf_long(void) {
+	enum {n = 1<<21};
+	char *s = malloc(n+1);
+	int i;
+	int r;
+
+	for (i = 0; i < n; i++) s[i] = '1';
+	s[n] = 0;
+	r = sscanf(s, "%d", &i);
+	free(s);
+}
+
 void test_fscanf(void) {
 	int i, x, y;
 	char a[100], b[100];
diff --git a/src/stdlib/strtol.c b/src/stdlib/strtol.c
index 7d9213f..0656527 100644
--- a/src/stdlib/strtol.c
+++ b/src/stdlib/strtol.c
@@ -39,16 +39,19 @@ void test_strtol(void) {
 		TEST(ul, strtoul(s="4294967296", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
 		TEST2(i, c-s, 10, "wrong final position %d != %d");
 		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, strtoul(s="-1", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST(ul, strtoul(s="-1", &c, 0), (unsigned long)-1, "bad conversion result: %lu != %lu");
 		TEST2(i, c-s, 2, "wrong final position %d != %d");
-		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, strtoul(s="-2", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, strtoul(s="-2", &c, 0), (unsigned long)-2, "bad conversion result: %lu != %lu");
 		TEST2(i, c-s, 2, "wrong final position %d != %d");
-		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, strtoul(s="-2147483648", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, strtoul(s="-2147483648", &c, 0), (unsigned long)-2147483648, "bad conversion result: %lu != %lu");
 		TEST2(i, c-s, 11, "wrong final position %d != %d");
-		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, strtoul(s="-2147483649", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, strtoul(s="-2147483649", &c, 0), (unsigned long)-2147483649, "bad conversion result: %lu != %lu");
+		TEST2(i, c-s, 11, "wrong final position %d != %d");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, strtoul(s="-4294967296", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
 		TEST2(i, c-s, 11, "wrong final position %d != %d");
 		TEST2(i, errno, ERANGE, "missing errno %d != %d");
 	} else {
diff --git a/src/stdlib/wcstol.c b/src/stdlib/wcstol.c
index fe8d747..c0d49d4 100644
--- a/src/stdlib/wcstol.c
+++ b/src/stdlib/wcstol.c
@@ -33,16 +33,19 @@ void test_wcstol(void) {
 		TEST(ul, wcstoul(s=L"4294967296", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
 		TEST2(i, c-s, 10, "wrong final position %d != %d");
 		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, wcstoul(s=L"-1", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST(ul, wcstoul(s=L"-1", &c, 0), (unsigned long)-1, "bad conversion result: %lu != %lu");
 		TEST2(i, c-s, 2, "wrong final position %d != %d");
-		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, wcstoul(s=L"-2", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, wcstoul(s=L"-2", &c, 0), (unsigned long)-2, "bad conversion result: %lu != %lu");
 		TEST2(i, c-s, 2, "wrong final position %d != %d");
-		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, wcstoul(s=L"-2147483648", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, wcstoul(s=L"-2147483648", &c, 0), (unsigned long)-2147483648, "bad conversion result: %lu != %lu");
 		TEST2(i, c-s, 11, "wrong final position %d != %d");
-		TEST2(i, errno, ERANGE, "missing errno %d != %d");
-		TEST(ul, wcstoul(s=L"-2147483649", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, wcstoul(s=L"-2147483649", &c, 0), (unsigned long)-2147483649, "bad conversion result: %lu != %lu");
+		TEST2(i, c-s, 11, "wrong final position %d != %d");
+		TEST2(i, errno, 0, "no overflow, but errno is %d != %d");
+		TEST(ul, wcstoul(s=L"-4294967296", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu");
 		TEST2(i, c-s, 11, "wrong final position %d != %d");
 		TEST2(i, errno, ERANGE, "missing errno %d != %d");
 	} else {