refine attachments handling