valgrind warning fixed