added retry for failed images and error recording