diff --git a/Geo/GEdgeCompound.cpp b/Geo/GEdgeCompound.cpp
index f2ad5d907aaa749a861d1302c7b56e062ebc065b..1d6d45be698810a528d694ac602ccc616ab686c7 100644
--- a/Geo/GEdgeCompound.cpp
+++ b/Geo/GEdgeCompound.cpp
@@ -12,10 +12,11 @@ GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound)
 {
   orderEdges ();
   int N = _compound.size();
-  v0 = _orientation[0] ?     _compound[0]->getBeginVertex() : _compound[0]->getEndVertex();
+  v0 = _orientation[0] ?   _compound[0]->getBeginVertex() :     _compound[0]->getEndVertex();
   v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() :   _compound[N-1]->getBeginVertex();
   v0->addEdge(this);
   v1->addEdge(this);
+  //  printf("%d -> %d\n",v0->tag(),v1->tag());
   parametrize();
 }
 
@@ -56,6 +57,22 @@ void GEdgeCompound::orderEdges()
     }
   }  
   _compound = _c;
+
+  if (_compound.size() < 2)return;
+  if (   _compound[0]->getEndVertex() != _compound[1]->getEndVertex() 
+      && _compound[0]->getEndVertex() != _compound[1]->getBeginVertex()){  
+    for (int i=0;i<_compound.size();i++){
+      _orientation[i] = !_orientation[i] ;
+    }
+  }
+//   for (int i=0;i<_compound.size();i++){
+//     printf("o %d e %d (%d,%d)\n",
+// 	   (int)_orientation[i],
+// 	   _compound[i]->tag(),
+// 	   _compound[i]->getBeginVertex()->tag(),
+// 	   _compound[i]->getEndVertex()->tag());
+//   }
+
 }
 
 int GEdgeCompound::minimumMeshSegments() const{
@@ -75,7 +92,7 @@ GEdgeCompound::~GEdgeCompound()
 }
 
 Range<double> GEdgeCompound::parBounds(int i) const { 
-  return Range<double>(0, _pars[_compound.size()-1]); 
+  return Range<double>(0, _pars[_compound.size()]); 
 }
 
 /*
@@ -90,8 +107,14 @@ void GEdgeCompound::getLocalParameter ( const double &t,
 {
   for (iEdge=0 ; iEdge<_compound.size() ;iEdge++){
     //    printf("iEdge %d par %g\n",iEdge,_pars[iEdge]);
-    if (t <= _pars[iEdge]){
-      tLoc = _orientation[iEdge] ? t - _pars[iEdge] : _pars[iEdge+1] - t;
+    double tmin = _pars[iEdge];
+    double tmax = _pars[iEdge+1];
+    if (t >= tmin && t <= tmax){      
+      Range<double> b = _compound[iEdge]->parBounds(0);
+      tLoc = _orientation[iEdge] ?
+	b.low()  + (t-tmin)/(tmax-tmin) * (b.high()-b.low()) :
+	b.high() - (t-tmin)/(tmax-tmin) * (b.high()-b.low()) ;
+      //      printf("%g %g %d\n",t,tLoc,iEdge);
       return;
     }
   }
@@ -99,10 +122,10 @@ void GEdgeCompound::getLocalParameter ( const double &t,
 
 void GEdgeCompound::parametrize() 
 {
+  _pars.push_back(0.0);
   for (int i=0;i<_compound.size();i++){
     Range<double> b = _compound[i]->parBounds(0);
-    if (!i)_pars.push_back(b.high() - b.low());
-    else _pars.push_back(_pars[i-1]+(b.high() - b.low()));
+    _pars.push_back(_pars[_pars.size()-1]+(b.high() - b.low()));
   }   
 }
 
diff --git a/Geo/STensor3.h b/Geo/STensor3.h
index a4659ffed59bf6ba9cb4fb3014662e9c95577472..42d5a64f202a9c975b12059e8dfb95737404c8fe 100644
--- a/Geo/STensor3.h
+++ b/Geo/STensor3.h
@@ -32,7 +32,7 @@ class SMetric3 {
   }
   // default constructor, identity 
   SMetric3(const double v = 1.0){
-    _val[0] = _val[2] = _val[5] = v;
+    _val[0] = _val[2] = _val[5] = 1./(v*v);
     _val[1] = _val[3] = _val[4] = 0.0;
   }
   SMetric3(const double l1,
diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp
index 606605cc328fb2cc9cdf30c35e5f7774e3b50a6f..0e58bf9acc9989ff2c6e14c85ad61c5dde2f6152 100644
--- a/Mesh/BackgroundMesh.cpp
+++ b/Mesh/BackgroundMesh.cpp
@@ -174,7 +174,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V,
 }
 
 
-// anisotropic version
+// anisotropic version of the background field
 SMetric3 BGM_MeshMetric(GEntity *ge, 
 			double U, double V, 
 			double X, double Y, double Z)
@@ -182,7 +182,7 @@ SMetric3 BGM_MeshMetric(GEntity *ge,
   // default lc (mesh size == size of the model)
   SMetric3 l1(CTX::instance()->lc);
 
-  // lc from points
+  // lc from points            
   SMetric3 l2(MAX_LC);
   if(CTX::instance()->mesh.lcFromPoints && ge->dim() < 2) 
     l2 = SMetric3(LC_MVertex_PNTS(ge, U, V));