checking for loaded event