Check for definedness before invoking isNaN

Otherwise, things like Num === Num fail