Fixed errors with attachments