valgrind (almost) passed