Fixed sorting of messages