remove \r and \n from the end of messages