Fixed sorting of cached scripts