improved script loading