Fixed crash when deleting old images.