fixed the sorting of chat messages