Fixed a bug in the engine.