Fixed not saving energy in battery
new script engine for more compatibility.