Fix memory errors.. thanks valgrind