Fixed some bugs that were causing the engine to crash