Update engine.js

Fix bug