diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp
index 6cb9df2a45844487715b5be901f90f846d87c637..5db8f3c3f7b938b62f9b7e80a9ebe0b164c8aeda 100644
--- a/Geo/GEdge.cpp
+++ b/Geo/GEdge.cpp
@@ -477,7 +477,7 @@ bool GEdge::XYZToU(const double X, const double Y, const double Z,
   double uMin = uu.low();
   double uMax = uu.high();
 
-  SVector3 Q(X, Y, Z), P;
+  const SVector3 Q(X, Y, Z);
 
   double init[NumInitGuess];
 
@@ -490,6 +490,7 @@ bool GEdge::XYZToU(const double X, const double Y, const double Z,
     //err2 = 1.0;
     iter = 1;
 
+    SVector3 P = position(u);
     SVector3 dPQ = P - Q;
     err = dPQ.norm();
 
@@ -512,12 +513,12 @@ bool GEdge::XYZToU(const double X, const double Y, const double Z,
 
   if(relax > 1.e-2) {
     //    Msg::Info("point %g %g %g on edge %d : Relaxation factor = %g",
-    //              Q.x(), Q.y(), Q.z(), 0.75 * relax);
-    return XYZToU(Q.x(), Q.y(), Q.z(), u, 0.75 * relax);
+    //              X, Y, Z, 0.75 * relax);
+    return XYZToU(X, Y, Z, u, 0.75 * relax);
   }
 
   //  Msg::Error("Could not converge reparametrisation of point (%e,%e,%e) on edge %d",
-  //             Q.x(), Q.y(), Q.z(), tag());
+  //             X, Y, Z, tag());
   return false;
 }
 
diff --git a/Geo/GEdge.h b/Geo/GEdge.h
index 9c96c4c66ad163d26d732edf9743b42ada6aa2f3..e0db7f1cb004995a780aef3536a5b7fbe34b598c 100644
--- a/Geo/GEdge.h
+++ b/Geo/GEdge.h
@@ -184,7 +184,7 @@ class GEdge : public GEntity{
 
   // compute the parameter U from a point XYZ
   virtual bool XYZToU(const double X, const double Y, const double Z,
-                      double &U, const double relax=0.5) const;
+                      double &U, const double relax=1) const;
 
   // compound
   void setCompound(GEdgeCompound *gec) { compound = gec; }
diff --git a/Geo/GEntity.h b/Geo/GEntity.h
index 2c30675979ceb22797ff2226b194832e637d56e3..9698d36544a69df40876d5dd0b0b2e11f665bc35 100644
--- a/Geo/GEntity.h
+++ b/Geo/GEntity.h
@@ -332,7 +332,7 @@ class GEntity {
   void setAllElementsVisible(bool val){ _allElementsVisible = val ? 1 : 0; }
 
   // get the number of mesh vertices in the entity
-  unsigned int getNumMeshVertices() { return (int)mesh_vertices.size(); }
+  unsigned int getNumMeshVertices() { return mesh_vertices.size(); }
 
   // get the mesh vertex at the given index
   MVertex *getMeshVertex(unsigned int index) { return mesh_vertices[index]; }