changed the way of waiting to be loaded