reserve/release script environment cleanup
Change if to assert in resetScriptEnv

m_scriptEnvIndex should never be negative when calling resetScriptEnv.
Fix bug with the assert statement in getScriptEnv