Fixing engine.dispose