diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp
index 2a025135eb519bbd5d9ee2c4cee96f8e9a7f67e6..172c743ba0dbad424043cee6e6e8909773b25c37 100644
--- a/Geo/CAD.cpp
+++ b/Geo/CAD.cpp
@@ -1,4 +1,4 @@
-// $Id: CAD.cpp,v 1.33 2001-10-29 08:52:19 geuzaine Exp $
+// $Id: CAD.cpp,v 1.34 2001-11-07 07:13:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -1203,6 +1203,21 @@ int compareTwoSurfaces (const void *a, const void *b){
 /* Fonction eliminant les doublons dans une
    geometrie*/
 
+void MaxNumPoint(void *a, void *b){
+  Vertex *v = *(Vertex**)a;
+  THEM->MaxPointNum = MAX(THEM->MaxPointNum,v->Num);
+}
+
+void MaxNumCurve(void *a, void *b){
+  Curve *c = *(Curve**)a;
+  THEM->MaxLineNum = MAX(THEM->MaxLineNum,c->Num);
+}
+
+void MaxNumSurface(void *a, void *b){
+  Surface *s = *(Surface**)a;
+  THEM->MaxSurfaceNum = MAX(THEM->MaxSurfaceNum,s->Num);
+}
+
 void Coherence_PS(void){
   ReplaceAllDuplicates (THEM);
 }
@@ -1239,8 +1254,12 @@ void ReplaceAllDuplicates ( Mesh *m ){
   List_Delete(All);
 
   end = Tree_Nbr(m->Points);
-
   if(start-end) Msg(DEBUG, "Removed %d duplicate points", start-end);
+  if(CTX.geom.old_newreg){
+    m->MaxPointNum=0;
+    Tree_Action(m->Points,MaxNumPoint);
+    Tree_Action(m->Vertices,MaxNumPoint);
+  }
 
   /* Replace old points in curves */
 
@@ -1307,6 +1326,10 @@ void ReplaceAllDuplicates ( Mesh *m ){
   end = Tree_Nbr(m->Curves);
 
   if(start-end) Msg(DEBUG, "Removed %d duplicate curves", start-end);
+  if(CTX.geom.old_newreg){
+    m->MaxLineNum=0;
+    Tree_Action(m->Curves,MaxNumCurve);
+  }
 
   /* Replace old curves in surfaces */
 
@@ -1345,6 +1368,10 @@ void ReplaceAllDuplicates ( Mesh *m ){
   end = Tree_Nbr(m->Surfaces);
 
   if(start-end) Msg(DEBUG, "Removed %d duplicate surfaces", start-end);
+  if(CTX.geom.old_newreg){
+    m->MaxSurfaceNum=0;
+    Tree_Action(m->Surfaces,MaxNumSurface);
+  }
 
   /* Replace old surfaces in volumes */
 
@@ -1522,6 +1549,7 @@ void DeletePoint(int ip){
     }
   }
   List_Delete(Curves);
+  if(v->Num == THEM->MaxPointNum) THEM->MaxPointNum--;
   Tree_Suppress(THEM->Points,&v);
 }
 
@@ -1537,6 +1565,7 @@ void DeleteCurve(int ip){
     }
   }
   List_Delete(Surfs);
+  if(c->Num == THEM->MaxLineNum) THEM->MaxLineNum--;
   Tree_Suppress(THEM->Curves,&c);
 }
 
@@ -1555,12 +1584,11 @@ void DeleteSurf( int is ){
     }
   }
   List_Delete(Vols);
+  if(s->Num == THEM->MaxSurfaceNum) THEM->MaxSurfaceNum--;
   //s->Num = 1000000000;
   Tree_Suppress(THEM->Surfaces,&s);
 }
 
-void DeleteLine(int ip, int i){DeleteCurve(ip);}
-
 void DeleteShape(int Type, int Num){
 
   switch(Type){
diff --git a/tutorial/t2.geo b/tutorial/t2.geo
index 678e4e95066e9d1a8485bb6f0d30b42b75c9536d..a3a1f7b9e37b7f85d7ba23b87e235fe32518190f 100644
--- a/tutorial/t2.geo
+++ b/tutorial/t2.geo
@@ -52,7 +52,7 @@ Extrude Surface { 11, {0, 0, h} } ;
 // manually a characteristic length for some of the automatically
 // created points:
 
-Characteristic Length{6,2,52,3,16,12} = lc * 2 ;
+Characteristic Length{6,22,2,3,16,12} = lc * 2 ;
 
 // If the transformation tools are handy to create complex geometries,
 // it is sometimes useful to generate the flat geometry, consisting
diff --git a/utils/gmsh.spec b/utils/gmsh.spec
index 25939190ec2394514ad0797792be9bd36ebac61b..26d800ad186e6d4093e4920496238b046f9899cc 100644
--- a/utils/gmsh.spec
+++ b/utils/gmsh.spec
@@ -2,7 +2,7 @@ Summary: A 3D mesh generator with pre- and post-processing facilities
 Name: gmsh
 Version: 1.28
 Source: gmsh-1.28.tar.gz
-Release: 1
+Release: 2
 Copyright: distributable
 Group: Applications/Engineering
 URL: http://www.geuz.org/gmsh/