test with valgrind; and also check what happens if mem leaks