Fixed some memory issues with valgrind