Fix some things valgrind reported