NaN checking per ozten suggestion, tests tweaked

Let's try this again.