added a try except block for deleting photos