More valgrind fixes