try using header.current_time instead of message.from_time whenever possible. We"ll see if it improves how we sort the chat messages