fix a bug about duplicately uploading attachments