Fixing valgrind errors.