Fixes after Valgrind