diff --git a/Testing/Utilities/classifyKNN2.cxx b/Testing/Utilities/classifyKNN2.cxx
index 45ed836033fe5499bd5a9ebac274902f79f3ca5b..ec91dd8269afacd3ac19eb2be4e2bf6e0abc71cc 100644
--- a/Testing/Utilities/classifyKNN2.cxx
+++ b/Testing/Utilities/classifyKNN2.cxx
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include "itkMinimumMaximumImageCalculator.h"
 
+
 #ifdef WIN32
 #include <winsock.h>
 #else
@@ -295,6 +296,7 @@ struct nodeDataNew {
       {
 	std::cerr << "Exception caught " << std::endl;
 	std::cerr << ee << std::endl;
+	return EXIT_FAILURE;
       }
 
 #ifdef WIN32
@@ -305,4 +307,5 @@ struct nodeDataNew {
    print_timing(stdout, start, end);
 #endif
   
+   return EXIT_SUCCESS;
 }//end main 
diff --git a/Utilities/otbknn/voronoiFilter.txx b/Utilities/otbknn/voronoiFilter.txx
index bb8bda20e7596aadbe29857a176e8b5f15fe1281..5f7ffd8b61ff0fbe06a61588462627711943c2bc 100644
--- a/Utilities/otbknn/voronoiFilter.txx
+++ b/Utilities/otbknn/voronoiFilter.txx
@@ -213,9 +213,18 @@ namespace itk
 
       for(i=0;i<m_K;i++) {
 	Element[index].DObj[i]=0;  
-      }      
+      }  
+      //Insert 1st element properly
       
-      dominio[index]=domainIt.Get();
+      if(dominio.size()==0)
+      {
+		dominio.insert(dominio.begin(),domainIt.Get());
+      }    
+      else
+      {
+		dominio.insert(dominio.end(),domainIt.Get());
+	  }
+	  
       if (dominio[index] != m_BackgroundValue) {
 	CurrentIndex=domainIt.GetIndex();
 	Element[index].icur=1;