Fix filename sorting for attachments