fixing valgrind error messages