finish the method checkInput