fixed more valgrind errors