Fixing bug in isValidNumber