asan: fix bugs in the testlib