Attempted to fix the bug in engine. Dunno if work.