removed some repetitive cases in isNumValid()