cust_attachment improvement, RT#4964 and #6225