fix valgrind discovered problem