fix errors found with valgrind