added counter function to check number of loaded images after each image has 100% finished loading