Fixed memory leak, NULL'd some deleted pointers