diff --git a/Src/Core/FFmmAlgorithmThread.hpp b/Src/Core/FFmmAlgorithmThread.hpp
index 5a5ae18ebd1875233b13da6c259d8c36b955e130..167ba9c3ee6d772a4b5957c13e8dfc60adfea93b 100644
--- a/Src/Core/FFmmAlgorithmThread.hpp
+++ b/Src/Core/FFmmAlgorithmThread.hpp
@@ -415,8 +415,6 @@ protected:
         };
         LeafData* const leafsDataArray = new LeafData[this->leafsNumber];
 
-        const int LeafIndex = OctreeHeight - 1;
-
         int startPosAtShape[SizeShape];
         startPosAtShape[0] = 0;
         for(int idxShape = 1 ; idxShape < SizeShape ; ++idxShape){
@@ -479,7 +477,7 @@ protected:
                     if(p2pEnabled){
                         // need the current particles and neighbors particles
                         FLOG(if(!omp_get_thread_num()) computationCounterP2P.tic());
-                        const int counter = tree->getLeafsNeighbors(neighbors, neighborPositions, currentIter.cell->getCoordinate(), LeafIndex);
+                        const int counter = tree->getLeafsNeighbors(neighbors, neighborPositions, currentIter.cell->getCoordinate(), OctreeHeight-1);
                         myThreadkernels.P2P(currentIter.cell->getCoordinate(), currentIter.targets,
                                             currentIter.sources, neighbors, neighborPositions, counter);
                         FLOG(if(!omp_get_thread_num()) computationCounterP2P.tac());
diff --git a/Src/Core/FFmmAlgorithmThreadBalance.hpp b/Src/Core/FFmmAlgorithmThreadBalance.hpp
index fcb17a02778b2cf8aa206df6e3deef5eebba16ee..fdb3ba977a7e7b464a6845f98f4d247849390705 100644
--- a/Src/Core/FFmmAlgorithmThreadBalance.hpp
+++ b/Src/Core/FFmmAlgorithmThreadBalance.hpp
@@ -381,7 +381,7 @@ protected:
                         const FSize nbPartInLeaf = octreeIterator.getCurrentListTargets()->getNbParticles();
                         workloadBuffer[positionToWork].amountOfWork = nbPartInLeaf*nbPartInLeaf;
                         ContainerClass* neighbors[27];
-                        tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(), LeafIndex);
+                        tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(), OctreeHeight-1);
                         for(int idxNeigh = 0 ; idxNeigh < 27 ; ++idxNeigh){
                             if(neighbors[idxNeigh]){
                                 workloadBuffer[positionToWork].amountOfWork +=
@@ -657,8 +657,6 @@ protected:
         FLOG(FTic computationCounter);
         FLOG(FTic computationCounterP2P);
 
-        const int LeafIndex = OctreeHeight - 1;
-
         #pragma omp parallel
         {
             FLOG(if(!omp_get_thread_num()) computationCounter.tic());
@@ -674,7 +672,7 @@ protected:
                     LeafData& currentIter = leafsDataArray[idxLeafs];
                     // need the current particles and neighbors particles
                     FLOG(if(!omp_get_thread_num()) computationCounterP2P.tic());
-                    const int counter = tree->getLeafsNeighbors(neighbors, neighborPositions, currentIter.coord, LeafIndex);
+                    const int counter = tree->getLeafsNeighbors(neighbors, neighborPositions, currentIter.coord, OctreeHeight-1);
                     myThreadkernels.P2P(currentIter.coord, currentIter.targets,
                                         currentIter.sources, neighbors, neighborPositions, counter);
                     FLOG(if(!omp_get_thread_num()) computationCounterP2P.tac());
diff --git a/Src/Core/FFmmAlgorithmThreadProc.hpp b/Src/Core/FFmmAlgorithmThreadProc.hpp
index 2aa50817335fa9ae027c1aa217aa34f241e47cb3..ddfeb086d8554ba1e6bc04c6fe3ce1e28d8b137a 100644
--- a/Src/Core/FFmmAlgorithmThreadProc.hpp
+++ b/Src/Core/FFmmAlgorithmThreadProc.hpp
@@ -1233,7 +1233,6 @@ protected:
         OctreeClass otherP2Ptree( tree->getHeight(), tree->getSubHeight(), tree->getBoxWidth(), tree->getBoxCenter() );
 
         // init
-        const int LeafIndex = OctreeHeight - 1;
         const int SizeShape = P2PExclusionClass::SizeShape;
 
         int shapeLeaf[SizeShape];
@@ -1459,7 +1458,7 @@ protected:
                                     }
                                     if(p2pEnabled){
                                         // need the current particles and neighbors particles
-                                        const int counter = tree->getLeafsNeighbors(neighbors, neighborPositions, currentIter.coord, LeafIndex);
+                                        const int counter = tree->getLeafsNeighbors(neighbors, neighborPositions, currentIter.coord, OctreeHeight-1);
                                         myThreadkernels->P2P( currentIter.coord,currentIter.targets,
                                                           currentIter.sources, neighbors, neighborPositions, counter);
                                     }