diff --git a/contrib/hxt/tetMesh/src/hxt_tetDelaunay.c b/contrib/hxt/tetMesh/src/hxt_tetDelaunay.c
index ebd561dceb46c829b7cfc34912be1c3072e82946..9bfab36e6958aacbec37b2abd3d4f6e447467d6a 100644
--- a/contrib/hxt/tetMesh/src/hxt_tetDelaunay.c
+++ b/contrib/hxt/tetMesh/src/hxt_tetDelaunay.c
@@ -517,6 +517,8 @@ static inline HXTStatus walking2Cavity(HXTMesh* mesh, HXTPartition* partition, u
 
     // we should pass in orient3d mode here :p
     unsigned index = 4;
+    unsigned outside = 0;
+    unsigned wantToGoInOtherPartition = 0;
     unsigned randomU = hxtReproducibleLCG(&seed);
     for (unsigned j=0; j<4; j++)
     {
@@ -534,6 +536,7 @@ static inline HXTStatus walking2Cavity(HXTMesh* mesh, HXTPartition* partition, u
           //                        vtaCoord[0], vtaCoord[1], vtaCoord[2]);
           // }
 
+          outside = 1;
           uint32_t node = mesh->tetrahedra.node[curNeigh[i]];
 
           if(node==HXT_GHOST_VERTEX) {
@@ -541,11 +544,14 @@ static inline HXTStatus walking2Cavity(HXTMesh* mesh, HXTPartition* partition, u
             return HXT_STATUS_OK;
           }
 
-          if(vertexOutOfPartition(vertices, node, rel, partition->startDist))
-            return HXT_STATUS_CONFLICT;
-
-          index=i;
-          break;
+          if(vertexOutOfPartition(vertices, node, rel, partition->startDist)){
+            if(wantToGoInOtherPartition++ > 1000)
+              return HXT_STATUS_CONFLICT;
+          }
+          else {
+            index=i;
+            break;
+          }
         }
       }
     }
@@ -555,10 +561,13 @@ static inline HXTStatus walking2Cavity(HXTMesh* mesh, HXTPartition* partition, u
       const double* __restrict__ b = vertices[curNode[1]].coord;
       const double* __restrict__ c = vertices[curNode[2]].coord;
       const double* __restrict__ d = vertices[curNode[3]].coord;
-      if( (orient3d(a,b,c,vtaCoord)>=0) +
-          (orient3d(a,b,vtaCoord,d)>=0) +
-          (orient3d(a,vtaCoord,c,d)>=0) +
-          (orient3d(vtaCoord,b,c,d)>=0)>2 ){
+      if(outside) {
+        return HXT_STATUS_CONFLICT;
+      }
+      else if( (orient3d(a,b,c,vtaCoord)>=0) +
+               (orient3d(a,b,vtaCoord,d)>=0) +
+               (orient3d(a,vtaCoord,c,d)>=0) +
+               (orient3d(vtaCoord,b,c,d)>=0)>2 ){
         *curTet = nextTet;
         return HXT_STATUS_DOUBLE_PT;
       }
@@ -566,12 +575,6 @@ static inline HXTStatus walking2Cavity(HXTMesh* mesh, HXTPartition* partition, u
       return HXT_STATUS_OK;
     }
 
-#ifdef DEBUG
-    nstep++;
-    if(nstep > mesh->tetrahedra.num)
-      return HXT_ERROR_MSG(HXT_STATUS_ERROR, "walk stuck in an infinite loop");
-#endif
-
     enteringFace = curNeigh[index]&3;
     nextTet = curNeigh[index]/4;
   }