Improve validation of message length on input.