Fix bug stopping documents having the same attachment