handle deleted attachments properly