Fix the message formatting code since it was breaking the emoji replacement