diff --git a/Mesh/3D_BGMesh.cpp b/Mesh/3D_BGMesh.cpp
index 49f98bc50ede5100d0b0a0bd4ff610210c816f21..55734700521c700339eddbbb4ae1bb322e31c3fd 100644
--- a/Mesh/3D_BGMesh.cpp
+++ b/Mesh/3D_BGMesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_BGMesh.cpp,v 1.40 2006-01-28 18:44:19 geuzaine Exp $
+// $Id: 3D_BGMesh.cpp,v 1.41 2006-01-28 19:53:18 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -30,18 +30,20 @@ extern Mesh *THEM;
 extern Context_T CTX;
 
 static OctreePost *BGM_OCTREE = NULL;
+static double BGM_MAX = 0.;
 
 int BGMWithView(Post_View * ErrView)
 {
   if(BGM_OCTREE) delete BGM_OCTREE;
   BGM_OCTREE = new OctreePost(ErrView);
+  BGM_MAX = ErrView->Max;
   Create_BgMesh(ONFILE, .2, THEM);
   return 1 ;
 }
 
 double Lc_XYZ(double X, double Y, double Z, Mesh * m)
 {
-  double l;
+  double l, fact[6] = {0.001, 0.005, 0.01, 0.05, 0.1, 0.5};
 
   switch (m->BGM.Typ) {
   case FUNCTION:
@@ -52,7 +54,18 @@ double Lc_XYZ(double X, double Y, double Z, Mesh * m)
     l = m->BGM.lc;
     break;
   case ONFILE:
-    BGM_OCTREE->searchScalar(X, Y, Z, &l, 0);
+    if(!BGM_OCTREE->searchScalar(X, Y, Z, &l, 0)){
+      for(int i = 0; i < 6; i++){
+	double eps = CTX.lc * fact[i];
+	if(BGM_OCTREE->searchScalar(X + eps, Y, Z, &l, 0)) break;
+	if(BGM_OCTREE->searchScalar(X - eps, Y, Z, &l, 0)) break;
+	if(BGM_OCTREE->searchScalar(X, Y + eps, Z, &l, 0)) break;
+	if(BGM_OCTREE->searchScalar(X, Y - eps, Z, &l, 0)) break;
+	if(BGM_OCTREE->searchScalar(X, Y, Z + eps, &l, 0)) break;
+	if(BGM_OCTREE->searchScalar(X, Y, Z - eps, &l, 0)) break;
+      }
+    }
+    if(l <= 0) l = BGM_MAX;
     break;
   case WITHPOINTS:
     Msg(GERROR, "We should never call Lc_XYZ with BGM.Typ == WITHPOINTS!");
@@ -61,7 +74,7 @@ double Lc_XYZ(double X, double Y, double Z, Mesh * m)
   }
 
   if(l <= 0.){
-    Msg(WARNING, "Characteristic length <= 0: setting to LC/10");
+    Msg(WARNING, "Characteristic length <= 0 at point (%g,%g,%g)", X, Y, Z);
     l = CTX.lc / 10.;
   }
 
diff --git a/Mesh/3D_Mesh_Netgen.cpp b/Mesh/3D_Mesh_Netgen.cpp
index d200e8eaa88dd40f5ed585c172e886d2fb0a65d7..ab25fb011662a9ef158eeeb8fddbdff39765bd1c 100644
--- a/Mesh/3D_Mesh_Netgen.cpp
+++ b/Mesh/3D_Mesh_Netgen.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh_Netgen.cpp,v 1.18 2006-01-06 00:34:26 geuzaine Exp $
+// $Id: 3D_Mesh_Netgen.cpp,v 1.19 2006-01-28 19:53:18 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -312,7 +312,11 @@ void Optimize_Netgen(Mesh *m)
   Msg(STATUS2, "Optimize volume mesh...");
   double t1 = Cpu();
 
-  Degre1(); // cleanup 2nd order vertices, if any
+  // cleanup 2nd order vertices, if any
+  Degre1(); 
+
+  // make sure we don't use any fancy background mesh
+  Create_BgMesh(WITHPOINTS, .2, m); 
 
   List_T *list = Tree2List(m->Volumes);
   for(int i = 0; i < List_Nbr(list); i++){
diff --git a/doc/VERSIONS b/doc/VERSIONS
index 4a072113ea8eb1e744a51afacf79cbf2fe6830bf..8d74e8ff3680f3d0d2d022654184cfe551354b26 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,7 +1,8 @@
-$Id: VERSIONS,v 1.355 2006-01-28 05:26:43 geuzaine Exp $
+$Id: VERSIONS,v 1.356 2006-01-28 19:53:18 geuzaine Exp $
 
-New since 1.62: post-processing views can now also be exported as 
-meshes; small bug fixes and enhancements.
+New since 1.62: post-processing views can now also be exported as
+meshes; speedup generation of meshes w/ background characteristic
+length fields from post-pro views; small bug fixes and enhancements.
 
 New in 1.62: new option to draw color gradients in the background;
 enhanced perspective projection mode; new "lasso" selection mode (same