Backporting attachment fixes