Fixed some memory leaks in the engine.
Merge pull request #118 from jchoover/39MemoryLeaks

Fixed some memory leaks in the engine.