Simplify some code in ScriptTask::load.