Fixes in attachments handling