diff --git a/Code/Learning/otbSEMClassifier.txx b/Code/Learning/otbSEMClassifier.txx
index 2d15f680d0c38e8768c15fef5bffc9cf953a317e..96a1946ec6cf0877558d569bce8540adfb49732b 100644
--- a/Code/Learning/otbSEMClassifier.txx
+++ b/Code/Learning/otbSEMClassifier.txx
@@ -110,7 +110,8 @@ SEMClassifier<TInputImage, TOutputImage>
     while (iterLabels != labels->End());
     m_ExternalLabels = 1;
     }
-  else if (labels.size() == m_NbSamples)
+  else if (m_ClassLabels.size() == m_NbSamples) //FIXME check if this
+                                                //is really the right condition
     {
     m_ClassLabels.resize(labels->Size());