diff --git a/Mesh/qualityMeasures.cpp b/Mesh/qualityMeasures.cpp
index b6fb73a09bb55f4070f8506728f3f6fc80ffd1b2..a8d344ecc51a0afa881a57179081b614433857ee 100644
--- a/Mesh/qualityMeasures.cpp
+++ b/Mesh/qualityMeasures.cpp
@@ -179,7 +179,7 @@ double qmTet(const double &x1, const double &y1, const double &z1,
       double A[3][3] = {{x2-x1,y2-y1,z2-z1},{x3-x1,y3-y1,z3-z1},{x4-x1,y4-y1,z4-z1}};
       double S[3][3],INVS[3][3];
       matmat(A,INVW,S);
-      *volume = inv3x3(S,INVS) * 2 / sqrt(2);
+      *volume = inv3x3(S,INVS) * 0.70710678118654762;//2/sqrt(2);
       double normS = norm2 (S);
       double normINVS = norm2 (INVS);
       return normS * normINVS;      
diff --git a/Mesh/yamakawa.cpp b/Mesh/yamakawa.cpp
index a694a566cfba7278b4eb1b4d21538d15354b95b4..d9f83b1364648c9e7a2f8bf57fbcb1e71476f0f4 100755
--- a/Mesh/yamakawa.cpp
+++ b/Mesh/yamakawa.cpp
@@ -999,7 +999,7 @@ MVertex* Recombinator::find(MVertex* v1,MVertex* v2,MVertex* v3,MVertex* already
   MElement* element;
   MVertex *a,*b,*c,*d;
   MVertex* pointer;
-  std::set<MElement*>::iterator it;
+  std::set<MElement*>::const_iterator it;
 
   pointer = 0;
 
@@ -1127,7 +1127,7 @@ bool Recombinator::inclusion(MVertex* v1,MVertex* v2,MVertex* v3,const std::set<
   bool flag1,flag2,flag3;
   MVertex *a,*b,*c,*d;
   MElement* element;
-  std::set<MElement*>::iterator it;
+  std::set<MElement*>::const_iterator it;
 
   ok = 0;
 
@@ -2341,7 +2341,7 @@ bool Supplementary::inclusion(MVertex* v1,MVertex* v2,MVertex* v3,const std::set
   bool flag1,flag2,flag3;
   MVertex *a,*b,*c,*d;
   MElement* element;
-  std::set<MElement*>::iterator it;
+  std::set<MElement*>::const_iterator it;
 	
   ok = 0;
 	
@@ -3389,7 +3389,7 @@ void PostOp::mean(const std::set<MVertex*>& Ns,MVertex* mid,const std::vector<ME
   bool flag;
   double x,y,z;
   double init_x,init_y,init_z;
-  std::set<MVertex*>::iterator it;
+  std::set<MVertex*>::const_iterator it;
 
   x = 0.0;
   y = 0.0;
diff --git a/contrib/HighOrderMeshOptimizer/OptHomRun.cpp b/contrib/HighOrderMeshOptimizer/OptHomRun.cpp
index 52ce0aaf19f3a220ffb4c25eeb6e926a374b8632..4eb27f3f4dcdbef2449f3f608f232d7f3c5fb23c 100644
--- a/contrib/HighOrderMeshOptimizer/OptHomRun.cpp
+++ b/contrib/HighOrderMeshOptimizer/OptHomRun.cpp
@@ -196,7 +196,7 @@ static void addBlobChaintoGroup(std::set<int> &group, const std::vector<std::set
     todoPB[iB] = false;
     group.insert(iB);
     const std::set<int> &connect = groupConnect[iB];
-    for (std::set<int>::iterator itBC = connect.begin(); itBC != connect.end(); ++itBC)
+    for (std::set<int>::const_iterator itBC = connect.begin(); itBC != connect.end(); ++itBC)
       addBlobChaintoGroup(group, groupConnect, todoPB, *itBC);
   }
 
diff --git a/contrib/onelab/OnelabClients.cpp b/contrib/onelab/OnelabClients.cpp
index 4da0983f35613d06fdcc16a0e2220bf1b33e56e7..9a8658b50d07e8626ce018b7f31e1605c500f9fa 100644
--- a/contrib/onelab/OnelabClients.cpp
+++ b/contrib/onelab/OnelabClients.cpp
@@ -2,6 +2,13 @@
 #include "OnelabClients.h"
 #include "StringUtils.h"
 #include <algorithm>
+#ifdef WIN32
+#define POPEN _popen
+#define PCLOSE _pclose
+#else
+#define POPEN popen
+#define PCLOSE pclose
+#endif
 
 class onelabMetaModelServer : public GmshServer{
  private:
@@ -510,15 +517,15 @@ bool remoteClient::checkCommandLine(const std::string &commandLine){
   mySystem(cmd);
 
   cmd.assign("ssh "+getRemoteHost()+" 'which "+commandLine+"'");
-  fp = popen(cmd.c_str(), "r");
+  fp = POPEN(cmd.c_str(), "r");
   if(fgets(cbuf, 1024, fp) == NULL){
     OLMsg::Warning("The executable <%s> does not exist",
 		 commandLine.c_str());
-    pclose(fp);
+    PCLOSE(fp);
     return false;
   }
   OLMsg::Info("The executable <%s> exists", commandLine.c_str());
-  pclose(fp);
+  PCLOSE(fp);
 
   return true;
 }
@@ -530,14 +537,14 @@ bool remoteClient::checkIfPresentRemote(const std::string &fileName){
 
   cmd.assign("ssh "+_remoteHost+" 'cd "+_remoteDir+"; ls "+fileName+" 2>/dev/null'");
   //std::cout << "check remote<" << cmd << ">" << std::endl;
-  fp = popen(cmd.c_str(), "r");
+  fp = POPEN(cmd.c_str(), "r");
   if(fgets(cbuf, 1024, fp) == NULL){
     OLMsg::Fatal("The file <%s> is not present", fileName.c_str());
-    pclose(fp);
+    PCLOSE(fp);
     return false;
   }
   OLMsg::Info("The file <%s> is present", fileName.c_str());
-  pclose(fp);
+  PCLOSE(fp);
   return true;
 }
 
@@ -1113,9 +1120,10 @@ bool checkIfPresent(std::string fileName){
   }
 }
 
-#include <unistd.h>
+
 #include <sys/types.h>
 #if not defined WIN32
+#include <unistd.h>
 #include <pwd.h>
 std::string getUserHomedir(){
   struct passwd *pw = getpwuid(getuid());
@@ -1123,9 +1131,16 @@ std::string getUserHomedir(){
   str.append("/");
   return str;
 }
+#include <sys/param.h>
+#else
+#include <direct.h>
 #endif
 
-#include <sys/param.h>
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
+
+
 std::string getCurrentWorkdir(){
   char path[MAXPATHLEN];
   getcwd(path, MAXPATHLEN);
diff --git a/contrib/onelab/OnelabParser.cpp b/contrib/onelab/OnelabParser.cpp
index 8d9a6efc7e5c62c8f59ee843aabc2b5cbe3b18dd..ebd06a4e7c5891e3ee5f63260a27404ba581b883 100644
--- a/contrib/onelab/OnelabParser.cpp
+++ b/contrib/onelab/OnelabParser.cpp
@@ -163,8 +163,8 @@ std::string extractExpandPattern(const std::string& str){
   return pattern; 
 }
 
-std::string localSolverClient::longName(const std::string name){
-  std::set<std::string>::iterator it;
+std::string localSolverClient::longName(std::string name){
+  std::set<std::string, ShortNameLessThan>::iterator it;
   std::string fullName;
   if((it = _parameters.find(name)) != _parameters.end())
     fullName.assign(OLMsg::obtainFullName(*it));