Corrected exception handling to account for skipped images.