fixing error when post has no attachments