Added NAN checking at source