wait for the loading process to complete before we resolve the promises