do some input validation