added counter to keep track of images succesfully loaded