fixed validation problem

two-step check if input is correct, very inspiring!