check inputs for validity