Minor bugfix in script-only code