Fix isNaN bug