fix isnan inconsistency on Linux/Unix