Merge "Fix a race condition in which an Attachment might be wrongly deleted"