Script execution mode detection tweak