diff --git a/NonLinearSolver/nlsolver/cutMeshByBox.cpp b/NonLinearSolver/nlsolver/cutMeshByBox.cpp
index 2554a880eab921559a57407e7e08a210a2f0d2d4..665bb8ec37ffb54f9b3f02273c9122b7410e56ec 100644
--- a/NonLinearSolver/nlsolver/cutMeshByBox.cpp
+++ b/NonLinearSolver/nlsolver/cutMeshByBox.cpp
@@ -286,7 +286,8 @@ std::set<MVertex*> cutMeshByBox::currentVertices;
 cutMeshByBox::cutMeshByBox(): _pModel(NULL),_g(NULL),_gVolume(NULL){}
 
 void cutMeshByBox::addModel(std::string meshFileName){
-	_pModel = new GModel();
+  _pModel = new GModel();
+  _pModel->setAsCurrent();
   _pModel->readMSH(meshFileName.c_str());
   int dim = _pModel->getNumRegions() ? 3 : 2;
   _g = new elementGroup();
diff --git a/NonLinearSolver/nlsolver/getTotalVolume.cpp b/NonLinearSolver/nlsolver/getTotalVolume.cpp
index 582d7ae5ffe191735fc5d72c91f999fd8c320740..eea04a0d09c44b36fe126efbafcf68beb49a804d 100644
--- a/NonLinearSolver/nlsolver/getTotalVolume.cpp
+++ b/NonLinearSolver/nlsolver/getTotalVolume.cpp
@@ -20,6 +20,7 @@ getTotalVolume::~getTotalVolume(){
 
 void getTotalVolume::loadModel(const std::string filename){
   GModel* pModel = new GModel();
+  pModel->setAsCurrent(); //to check
   pModel->readMSH(filename.c_str());
   int dim = pModel->getNumRegions() ? 3 : 2;
   std::map<int, std::vector<GEntity*> > groups[4];
diff --git a/NonLinearSolver/nlsolver/imperfectionToMesh.cpp b/NonLinearSolver/nlsolver/imperfectionToMesh.cpp
index 3b46b1c7b1a69ed90293d300fc9fedf50671b971..dbe414a3153cd228d565763e75957111d9f81b8f 100644
--- a/NonLinearSolver/nlsolver/imperfectionToMesh.cpp
+++ b/NonLinearSolver/nlsolver/imperfectionToMesh.cpp
@@ -166,6 +166,7 @@ void imperfectionPart::addAllEntities(){
 void imperfectionToMesh::loadModel(const std::string meshFileName)
 {
   _pModel = new GModel();
+  _pModel->setAsCurrent(); //to check
   _pModel->readMSH(meshFileName.c_str());
   _meshFileName = meshFileName;
 }
@@ -182,6 +183,7 @@ void imperfectionToMesh::addImperfection(imperfectionPart* ip){
 void imperfectionToMesh::imposeImperfection(const std::string fname){
   Msg::Info("Begin writing perturbed mesh");
   GModel* dispgmodel = new GModel();
+  dispgmodel->setAsCurrent(); //to check
   dispgmodel->readMSH(_meshFileName.c_str());
   std::set<MVertex*> allPerturbedVertices;
   for (int i=0; i<_allImperfectionPart.size(); i++){
diff --git a/NonLinearSolver/nlsolver/meshModification.cpp b/NonLinearSolver/nlsolver/meshModification.cpp
index 5b79feed1758d844a62ad80e2eca3e8bce7aa6a4..68cf8ea372e23e37cb9dda287414b14e0f1d3f1d 100644
--- a/NonLinearSolver/nlsolver/meshModification.cpp
+++ b/NonLinearSolver/nlsolver/meshModification.cpp
@@ -26,6 +26,7 @@ void meshModification::loadModel(const std::string meshFileName)
 {
   if (_pModel) delete _pModel;
   _pModel = new GModel();
+  _pModel->setAsCurrent(); //to check
   _pModel->readMSH(meshFileName.c_str());
   _meshFileName = meshFileName;
 };
@@ -34,6 +35,7 @@ void meshModification::loadGeo(const std::string geoFile, int dimToMesh, int ord
 {
   if (_pModel) delete _pModel;
   _pModel = new GModel();
+  _pModel->setAsCurrent(); //to check
   _pModel->readGEO(geoFile);
   // Overwrite options
   CTX::instance()->mesh.order = order;
@@ -314,6 +316,7 @@ void QuadToTriangle::loadModel(const std::string meshFileName)
 {
   if (_pModel) delete _pModel;
   _pModel = new GModel();
+  _pModel->setAsCurrent(); //to check
   _pModel->readMSH(meshFileName.c_str());
 };
 
@@ -409,4 +412,4 @@ void QuadToTriangle::apply(const std::string fname)
   write_MSH2(allG,fname);
   
   Msg::Info("done modifying mesh");
-};
\ No newline at end of file
+};
diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
index 0630359883c64270814d15fdd632517172a3370b..55208a0562ae842566b020feed7cd22619537385 100644
--- a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
+++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
@@ -17103,6 +17103,7 @@ void nonLinearMechSolver::setDisturbedEigenMode(int num, double val, bool flag){
 void nonLinearMechSolver::writeDisturbedMeshByEigenVector(eigenSolver& eigS, int numberMode, double fact){
 	Msg::Info("Begin writing deformed mesh");
   GModel* dispgmodel = new GModel();
+  dispgmodel->setAsCurrent();
   dispgmodel->readMSH(_meshFileName.c_str());
   std::set<MVertex*> computedVertex;
 
@@ -17158,6 +17159,7 @@ void nonLinearMechSolver::setWriteDeformedMeshToFile(bool flag){
 void nonLinearMechSolver::writeDeformedMesh(int step){
   Msg::Info("Begin writing deformed mesh");
   GModel* dispgmodel = new GModel();
+  dispgmodel->setAsCurrent();
   dispgmodel->readMSH(_meshFileName.c_str());
   std::set<MVertex*> computedVertex;
 
diff --git a/NonLinearSolver/nlsolver/showDataOnMesh.cpp b/NonLinearSolver/nlsolver/showDataOnMesh.cpp
index 4da21c701d9a1231f528c544a601587e2a464329..7637eaf788e09b4bf60b706c6faa8aa36c7d585e 100644
--- a/NonLinearSolver/nlsolver/showDataOnMesh.cpp
+++ b/NonLinearSolver/nlsolver/showDataOnMesh.cpp
@@ -13,6 +13,7 @@
 showDataOnMesh::showDataOnMesh(const std::string meshFileName)
 {
   _pModel = new GModel();
+  _pModel->setAsCurrent(); //to check
   _pModel->readMSH(meshFileName.c_str());
   _meshFileName = meshFileName;
   
@@ -35,6 +36,7 @@ void showDataOnMesh::dataOnPhysical(int dim, int phys, const std::string partMes
   write_MSH2(_gr,partMeshFile.c_str());
   
   _part = new GModel();
+  _part->setAsCurrent(); //to check
   _part->readMSH(partMeshFile.c_str()); 
 }
 
diff --git a/NonLinearSolver/nlsolver/strainMapping.cpp b/NonLinearSolver/nlsolver/strainMapping.cpp
index 7381569e5d6e6e05068579d46b6166d5803c8063..fca0c32dc3899c52ea30f44c1761fc65779336cf 100644
--- a/NonLinearSolver/nlsolver/strainMapping.cpp
+++ b/NonLinearSolver/nlsolver/strainMapping.cpp
@@ -28,6 +28,7 @@ strainMapping::~strainMapping(){
 void strainMapping::readMesh(const std::string meshFileName){
   _meshFileName = meshFileName;
   _pModel = new GModel();
+  _pModel->setAsCurrent(); //to check
   _pModel->readMSH(meshFileName.c_str());
   int dim = _pModel->getNumRegions() ? 3 : 2;
   _g = new elementGroup();
diff --git a/NonLinearSolver/periodicBC/geometryRotation.cpp b/NonLinearSolver/periodicBC/geometryRotation.cpp
index 01f028811c8481cf32903b37ac59517ec5a22a9e..f082ccd6b395830e785692de62f7c9e1c4ab7800 100644
--- a/NonLinearSolver/periodicBC/geometryRotation.cpp
+++ b/NonLinearSolver/periodicBC/geometryRotation.cpp
@@ -118,6 +118,7 @@ void GeometryRotation::exportRotatedModel(const double e1x, const double e1y, co
   n3.normalize();
 
   GModel* pModel = new GModel();
+  pModel->setAsCurrent(); //to check
   pModel->readMSH(inMeshFile.c_str());
   pModel->setFileName(inMeshFile);