diff --git a/geomagio/algorithm/SqDistAlgorithm.py b/geomagio/algorithm/SqDistAlgorithm.py
index a3e65e91118acf30bb0331674858f2863cb341d6..acc66392a1d71a41aa296b3d597dbb567256e743 100644
--- a/geomagio/algorithm/SqDistAlgorithm.py
+++ b/geomagio/algorithm/SqDistAlgorithm.py
@@ -332,7 +332,7 @@ class SqDistAlgorithm(Algorithm):
         # set some default values
         if l0 is None:
             l = np.nanmean(yobs[0:int(m)])
-            if l is np.nan:
+            if np.isnan(l):
                 l = 0.
         else:
             l = l0