delete insets and attachments function fixed