Added a check for all images being loaded