fix #1286 NaN misinterpreted as a Number