Fixed another casting issue.

Found one more casting issue that can occur when working with
attachments.