added NaN test for check_nonnegative