fix script loading for autoptimize