Fix a bug where new attachments were never inserted