Fix for deprecation of nans()