Fixed bug that dispatched several onloaded events