Fix range check in validID