Fixed bug in deleting images.