check msg len before sending