Fix for scripts (cherry pick)

I had to make quite some changes for my personal situation for this script. Therefore my history is messed up.

However I made some worthwhile changes to the `script` section. I had the problem it did not always load corectly on Safari (OSX) or Safari in iOS. With these changes it does.

I could not figure out a use for the `latch` paramater so I deleted it. You might want to close this pull request without merging but cherry pick some changes!