modify loadScript, add load eventlistener