Removed some valgrind errors