Fixed bug in attachments serializer

Last pull-request has a bug. This pull-request solves that.