Added handling of isNaN and undefined