Fixing engine.clear bug