fix a logic error in the helper when creating remote_links
[#162] fix sorting of attachments to not break MSSQL