check input value to avoid errors