Fix wrong instantiation of Attachment

Introduced with changeset 60c08c72a159

issue3481
review1621003