fix remaining memory leak found by valgrind