cleanup(): restored the check for NaN for backwards compatibility