Harden worker and improve script caching

@proby -- want to review this?