Moving isModified() inside getScriptAsString() would not need to set script = null