Fix small bug in validating