Fix valgrind issue