validate inputs.