fixed valgrind complains