NaN checking and logging.