fixes crash when deleting all images