fixes after valgrind memcheck