Added NaN management