validation and error hadle