diff --git a/app/otbClearCutsDetection.cxx b/app/otbClearCutsDetection.cxx
index 935a8b627d34517e14dfa958d7f2b62df2484bd3..268166c8574f341e51d7265d7e2ba846a9c0ace0 100644
--- a/app/otbClearCutsDetection.cxx
+++ b/app/otbClearCutsDetection.cxx
@@ -259,6 +259,8 @@ public:
     m_StatsFilter->SetIgnoreUserDefinedValue(true);
     m_StatsFilter->SetUserIgnoredValue(m_DeltaNDVIFilter->GetFunctor().GetNoDataValue());
 
+    FloatImageType * deltaNDVIImage = m_DeltaNDVIFilter->GetOutput();
+
     // Mask directory
     if (HasValue("masksdir") || HasValue("mask"))
       {
@@ -266,9 +268,7 @@ public:
       m_MaskImageFilter = MaskImageFilterType::New();
       m_MaskImageFilter->SetInput(m_DeltaNDVIFilter->GetOutput());
       m_MaskImageFilter->SetOutsideValue(3.0);
-
-      // Wire stats filter
-      m_StatsFilter->SetInput(m_MaskImageFilter->GetOutput());
+      deltaNDVIImage = m_MaskImageFilter->GetOutput();
 
       // If there is a directory specified for masks, we instanciate the handler
       if (HasValue("masksdir"))
@@ -303,7 +303,7 @@ public:
       // Wiring final mask to mask image filter
       if (HasValue("masksdir") && HasValue("mask"))
         {
-        // If both masks types are specified, we need to instanciate a AndImageFilter
+        // If both masks types are specified, we need to instantiate a AndImageFilter
         m_AndFilter = AndFilterType::New();
         m_AndFilter->SetInput1(m_MaskHandler->GetOutput());
         m_AndFilter->SetInput2(m_MaskResampleFilter->GetOutput());
@@ -321,11 +321,9 @@ public:
         }
 
       }
-    else
-      {
-      // Wire stats filter
-      m_StatsFilter->SetInput(m_DeltaNDVIFilter->GetOutput());
-      }
+
+    // Wire stats filter
+    m_StatsFilter->SetInput(deltaNDVIImage);
 
     // Compute stats
     AddProcess(m_StatsFilter->GetStreamer(),"Computing dNDVI statistics");
@@ -334,12 +332,12 @@ public:
     if (HasValue("outdndvi"))
       {
       // Connect delta NDVI to output
-      SetParameterOutputImage("outdndvi", m_DeltaNDVIFilter->GetOutput());
+      SetParameterOutputImage("outdndvi", deltaNDVIImage);
       }
 
     // Label image output
     m_NDVILabelFilter = NDVILabelImageFilterType::New();
-    m_NDVILabelFilter->SetInput(m_DeltaNDVIFilter->GetOutput());
+    m_NDVILabelFilter->SetInput(deltaNDVIImage);
     m_NDVILabelFilter->SetInputMeanObject(m_StatsFilter->GetMeanOutput());
     m_NDVILabelFilter->SetInputSigmaObject(m_StatsFilter->GetSigmaOutput());
     m_NDVILabelFilter->SetInputNoDataValue(m_DeltaNDVIFilter->GetFunctor().GetNoDataValue());