diff --git a/Mesh/2D_InitMesh.cpp b/Mesh/2D_InitMesh.cpp
index 90450b828cf055e9fa01628aa683eadb4ae9d0fa..81e053c6f06bc8773653631abb5bacdf39ee3ae6 100644
--- a/Mesh/2D_InitMesh.cpp
+++ b/Mesh/2D_InitMesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_InitMesh.cpp,v 1.9 2001-08-13 09:38:14 geuzaine Exp $
+// $Id: 2D_InitMesh.cpp,v 1.10 2001-09-05 09:06:36 geuzaine Exp $
 
 /*
  
@@ -60,7 +60,7 @@
 #include "2D_Mesh.h"
 
 static int            pointA,pointB,Counter,Stagnant,StopNow;
-static Tree_T        *ETree,*EDToSwap;
+static Tree_T        *ETree=NULL,*EDToSwap=NULL;
 
 extern PointRecord   *gPointArray;
 
@@ -126,6 +126,9 @@ int crossED ( ED * e ){
 
   if(t>1. || t<0.)return(0);
   if(q>1. || q<0.)return(0);
+
+  //printf("t=%g  q=%g  det=%g\n", t, q, det);
+
   return(1);
 }
  
@@ -185,6 +188,11 @@ void SwapED ( void *data , void *dummy){
   if(Stagnant && Counter <= StopNow)return;
   else if(Stagnant)Counter++;
 
+  if(!e->Liste[0] || !e->Liste[1]){
+    Msg(GERROR, "Initial mesh is wrong. Try new isotropic algorithm.");
+    return;
+  }
+
   if(e->from != e->Liste[0]->t.a && e->from != e->Liste[0]->t.b &&
      e->from != e->Liste[0]->t.c )
     return;
@@ -270,7 +278,7 @@ int verifie_cas_scabreux (int pa, int pb, ContourRecord **ListContours, int Nc){
 }
 
 void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour, 
-                   int NumContours , int NumDelaunay){
+                   int NumContours){
 
   ED   *pEdge;
   ED   Edge; 
@@ -285,7 +293,7 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
     c++;
     if(c>max)break;
     ETree = Tree_Create ( sizeof (Edge) , compareED );
-    for (i=0;i< NumDelaunay;i++) {
+    for (i=0;i< List_Nbr(ListDelaunay);i++) {
 
       del_P = *(Delaunay**)List_Pointer(ListDelaunay, i);
 
@@ -298,6 +306,7 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
       }
       else {
         Edge.Liste[0] = del_P;
+        Edge.Liste[1] = NULL;
         Tree_Add (ETree,&Edge);
       }
       
@@ -309,6 +318,7 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
       }
       else {
         Edge.Liste[0] = del_P;
+        Edge.Liste[1] = NULL;
         Tree_Add (ETree,&Edge);
       }
       
@@ -320,6 +330,7 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
       }
       else {
         Edge.Liste[0] = del_P;
+        Edge.Liste[1] = NULL;
         Tree_Add (ETree,&Edge);
       }
     }
@@ -348,9 +359,10 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
     if(!ok){
       return;
     }
+    
     Msg(INFO, "Swapping (%d missing edges)", ok); 
     
-    EDToSwap = NULL;
+    //EDToSwap = NULL;
     if(EDToSwap)Tree_Delete(EDToSwap);
     EDToSwap = Tree_Create (sizeof(ED),compareED2);
     for(k=0;k<NumContours;k++){
@@ -379,10 +391,10 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
     Tree_Action (EDToSwap , SwapED);
     Tree_Action (EDToSwap , AddInETree);
   }while(Tree_Nbr(EDToSwap));
-/*
+
   Tree_Delete(EDToSwap);
   Tree_Delete(ETree);
-*/
+
 }
 
 
diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp
index 06dd5866a23e5d6e968e1e9cb9cd918cfa4d0146..59944931c5dda97faa9bfa617fead1eedcbb77a6 100644
--- a/Mesh/2D_Mesh.cpp
+++ b/Mesh/2D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Mesh.cpp,v 1.34 2001-08-24 06:58:19 geuzaine Exp $
+// $Id: 2D_Mesh.cpp,v 1.35 2001-09-05 09:06:36 geuzaine Exp $
 
 /*
    Maillage Delaunay d'une surface (Point insertion Technique)
@@ -317,10 +317,16 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
 
   for(i= 0;i<doc->numTriangles;i++){
     del_P = &doc->delaunay[i] ;
-    List_Add(del_L, &del_P);
+    if((del_P->t.a == del_P->t.b) &&
+       (del_P->t.a == del_P->t.c)){
+      Msg(GERROR, "Initial mesh is wrong. Try the new isotropic algorithm.");
+    }
+    else
+      List_Add(del_L, &del_P);
   }
+  doc->numTriangles = List_Nbr(del_L);
   
-  verify_edges (del_L, ListContours, numcontours, doc->numTriangles);
+  verify_edges (del_L, ListContours, numcontours);
   verify_inside (doc->delaunay, doc->numTriangles);
 
   /* creation des liens ( triangles voisins ) */
diff --git a/Mesh/2D_Mesh.h b/Mesh/2D_Mesh.h
index 2657828585337be43e6d46ccdb855118af6dc3ba..d5c8390806198a187c14fe2477e8017aa74538c9 100644
--- a/Mesh/2D_Mesh.h
+++ b/Mesh/2D_Mesh.h
@@ -48,7 +48,7 @@ int CreateLinks(List_T * ListDelaunay , int NumDelaunay,
 
 void makepermut (int numpoints);
 void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour, 
-                   int NumContours , int NumDelaunay);
+                   int NumContours);
 void verify_inside (Delaunay * ListDelaunay ,  int NumDelaunay );
 
 void PushgPointArray(PointRecord *ptr);