fix isNumber bug, remove redundant ternary operator