Fixed NullPointerException in engine.