Fixed bug in image count