server: improve script loading