add some more error handling of input