improved attachment handling --KW