diff --git a/scripts/plot_NN_2D.py b/scripts/plot_NN_2D.py
index 155509512a3e53ca3ff62b0a9f33612c2042c6e7..f5f9fee964bb1521bdf9bdd578c09ebac5bdbf0d 100755
--- a/scripts/plot_NN_2D.py
+++ b/scripts/plot_NN_2D.py
@@ -82,7 +82,7 @@ total_weights = c.w_test*np.array(c.class_weight)[c.y_test.astype(int)]
 
 try:
     mask_value = c.mask_value
-except NameError:
+except AttributeError:
     mask_value = None
 
 # varx_test = c.x_test[:,varx_index]