replaced Number.isNaN with isNaN