fixed misorder of loading scripts