rewrited setAttachment api