fixed valgrind complaints