diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp
index f2ad9f9378a431230adfab50090b70efb617e010..d181243de5b7014a34e2cd7d51e0949b86ab6b16 100644
--- a/Geo/GEdge.cpp
+++ b/Geo/GEdge.cpp
@@ -18,7 +18,7 @@
 
 GEdge::GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1)
   : GEntity(model, tag), _length(0.), _tooSmall(false), _cp(0),
-    v0(_v0), v1(_v1), compound(0)
+    v0(_v0), v1(_v1), compound(0), masterOrientation(0)
 {
   if(v0) v0->addEdge(this);
   if(v1 && v1 != v0) v1->addEdge(this);
@@ -45,12 +45,13 @@ void GEdge::deleteMesh()
   model()->destroyMeshCaches();
 }
 
-void GEdge::setMeshMaster(GEdge* ge,int ori) {
-
+void GEdge::setMeshMaster(GEdge* ge,int ori)
+{
+#if !defined(_MSC_VER)
 #warning missing:computation of affine transformation during setMeshMaster
-
+#endif
   GEntity::setMeshMaster(ge);
-  masterOrientation = ori > 0 ? 1:-1;
+  masterOrientation = ori > 0 ? 1 : -1;
 
   if (ori < 0) {
     vertexCounterparts[getBeginVertex()] = ge->getEndVertex();
@@ -572,7 +573,6 @@ SPoint3 GEdge :: closestPoint (SPoint3 &p, double tolerance)
   return (*_cp)(p);
 }
 
-
 typedef struct {
   SPoint3 p;
   double t;
diff --git a/Geo/GEdge.h b/Geo/GEdge.h
index f06821021bc86641c3c1a547894a07b421a5263e..47103e812c7f819b72ba4a93c12ec3d9071c0d89 100644
--- a/Geo/GEdge.h
+++ b/Geo/GEdge.h
@@ -25,9 +25,7 @@ class GEdgeCompound;
 class closestPointFinder;
 
 // A model edge.
-class GEdge : public GEntity {
-
-  
+class GEdge : public GEntity{
  private:
   double _length;
   bool _tooSmall;
@@ -42,7 +40,6 @@ class GEdge : public GEntity {
   // for specific solid modelers that need to re-do the internal curve
   // if a topological change ending points is done (glueing)
   virtual void replaceEndingPointsInternals(GVertex *, GVertex *) {}
-    
  public:
   GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1);
   virtual ~GEdge();
@@ -62,7 +59,7 @@ class GEdge : public GEntity {
 
   // specify mesh master and edgeCounterparts, deduce transformation
   void setMeshMaster(GEdge* master,int sign);
-  
+
   void reverse();
 
   // add/delete a face bounded by this edge
diff --git a/Geo/GFace.h b/Geo/GFace.h
index e337d1914b84bebb0d692fe1b846e6fe9ee0b3b6..3886c4308e037d8f708aa5b73875a52d0e1df500 100644
--- a/Geo/GFace.h
+++ b/Geo/GFace.h
@@ -34,8 +34,7 @@ struct surface_params
 class GRegion;
 
 // A model face.
-class GFace : public GEntity
-{
+class GFace : public GEntity{
  protected:
   // edge loops might replace what follows (list of all the edges of
   // the face + directions)
@@ -54,16 +53,16 @@ class GFace : public GEntity
 
  public: // this will become protected or private
   std::list<GEdgeLoop> edgeLoops;
-  
+
   // periodic counterparts of edges
   std::map<GEdge*,std::pair<GEdge*,int> > edgeCounterparts;
-  
+
   // specify mesh master with transformation, deduce edgeCounterparts
   void setMeshMaster(GFace* master,const std::vector<double>&);
 
   // specify mesh master and edgeCounterparts, deduce transformation
   void setMeshMaster(GFace* master,const std::map<int,int>&);
-  
+
   // an array with additional vertices that are supposed to exist in
   // the final mesh of the model face. This can be used for boundary
   // layer meshes or when using Lloyd-like smoothing algorithms those
diff --git a/Geo/GModelIO_MSH.cpp b/Geo/GModelIO_MSH.cpp
index ee696a558d9c1c4beefa2bb97a72218519b00e05..ace1af9d50113c3e4ccd04e131bfc8ee36df8fef 100644
--- a/Geo/GModelIO_MSH.cpp
+++ b/Geo/GModelIO_MSH.cpp
@@ -63,21 +63,21 @@ void readMSHPeriodicNodes(FILE *fp, GModel *gm)
     case 2 : s = gm->getFaceByTag(slave);   m = gm->getFaceByTag(master);   break;
     }
     if (s && m){
-      
       char token[6];
       fpos_t pos;
-      fgetpos(fp,&pos);
-      fscanf(fp,"%s",token);
-      if (strcmp(token,"Affine") == 0) {
+      fgetpos(fp, &pos);
+      if(fscanf(fp, "%s", token) != 1) return;
+      if(strcmp(token, "Affine") == 0) {
         std::vector<double> tfo;
-        for (int i=0;i<16;i++) fscanf(fp,"%lf",&tfo[i]);
-        s->setMeshMaster(m,tfo);
+        for(int i = 0; i < 16; i++){
+          if(fscanf(fp, "%lf", &tfo[i]) != 1) return;
+        }
+        s->setMeshMaster(m, tfo);
       }
       else {
-        fsetpos(fp,&pos);
+        fsetpos(fp, &pos);
         s->setMeshMaster(m);
       }
-      
       int numv;
       if(fscanf(fp, "%d", &numv) != 1) numv = 0;
       for(int j = 0; j < numv; j++){