diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index c676b9732fce2e08207c377ebc5249cb7551934c..5890ce3c52360b117ed547bcb60a1d6bbce954b8 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -197,8 +197,6 @@ int GmshBatch()
   currtime.resize(currtime.size() - 1);
   Msg::Info("Stopped on %s", currtime.c_str());
 
-  Msg::FinalizeClient();
-
   return 1;
 }
 
diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index 5988a5894c9d7d76790e7b31bede60d24ec5061e..532f894c9973030544660c85b12d8bfca2e11c89 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -574,36 +574,16 @@ int Msg::GetAnswer(const char *question, int defaultval, const char *zero,
     return atoi(ret);
 }
 
-void Msg::InitClient(std::string sockname)
-{
-  if(_client) delete _client;
-  _client = new GmshClient();
-  if(_client->Connect(sockname.c_str()) < 0){
-    Msg::Error("Unable to connect to server on %s", sockname.c_str());
-    delete _client;
-    _client = 0;
-  }
-  else
-    _client->Start();
-}
-
-void Msg::FinalizeClient()
-{
-  if(_client){
-    _client->Stop();
-    _client->Disconnect();
-    delete _client;
-  }
-  _client = 0;
-}
-
 void Msg::InitializeOnelab(const std::string &name, const std::string &sockname)
 {
   if(_onelabClient) delete _onelabClient;
   if (sockname.empty())
     _onelabClient = new onelab::localClient(name);
-  else
-    _onelabClient = new onelab::remoteNetworkClient(name, sockname);
+  else{
+    onelab::remoteNetworkClient *c = new onelab::remoteNetworkClient(name, sockname);
+    _onelabClient = c;
+    _client = c->getGmshClient();
+  }
 }
 
 void Msg::ExchangeOnelabParameter(const std::string &key,
@@ -657,6 +637,7 @@ void Msg::FinalizeOnelab()
   if(_onelabClient){
     delete _onelabClient;
     _onelabClient = 0;
+    _client = 0;
   }
 }
 
diff --git a/Common/GmshMessage.h b/Common/GmshMessage.h
index 868496348b7a4aa50939efd4532167591770c166..10c99dcda9d2655cfaa6d807263967324c2ab225 100644
--- a/Common/GmshMessage.h
+++ b/Common/GmshMessage.h
@@ -81,10 +81,8 @@ class Msg {
   static std::string GetString(const char *text, std::string defaultval);
   static int GetAnswer(const char *question, int defaultval, const char *zero, 
                        const char *one, const char *two=0);
-  static void InitClient(std::string sockname);
-  static GmshClient *GetClient(){ return _client; }
-  static void FinalizeClient();
   static void InitializeOnelab(const std::string &name, const std::string &sockname="");
+  static GmshClient *GetGmshClient(){ return _client; }
   static void FinalizeOnelab();
   static bool UseOnelab(){ return _onelabClient ? true : false; }
   static void ExchangeOnelabParameter(const std::string &key, 
diff --git a/Common/GmshRemote.cpp b/Common/GmshRemote.cpp
index f00d82943d921e58471e7234f90f962a6bc43959..d26315466c822ba115a757eb3165a11fb6dba561 100644
--- a/Common/GmshRemote.cpp
+++ b/Common/GmshRemote.cpp
@@ -168,7 +168,7 @@ static void gatherAndSendVertexArrays(GmshClient* client, bool swap)
 
 int GmshRemote()
 {
-  GmshClient *client = Msg::GetClient();
+  GmshClient *client = Msg::GetGmshClient();
 
   int rank = Msg::GetCommRank();
   int nbDaemon = Msg::GetCommSize();
diff --git a/Common/onelab.h b/Common/onelab.h
index 3c81032c1fcc3798b762652706bdbb4656345900..3f88b7c48da837bf5398fd4c288fb8d91b359e43 100644
--- a/Common/onelab.h
+++ b/Common/onelab.h
@@ -589,7 +589,7 @@ namespace onelab{
     void setSocketSwitch(const std::string &s){ _socketSwitch = s; }
     int getPid(){ return _pid; }
     void setPid(int pid){ _pid = pid; }
-    GmshServer const *getServer(){ return _gmshServer; }
+    GmshServer *getGmshServer(){ return _gmshServer; }
     void setServer(GmshServer *server){ _gmshServer = server; }
     virtual bool run(const std::string &what);
     virtual bool kill();
@@ -678,6 +678,7 @@ namespace onelab{
         _gmshClient = 0;
       }
     }
+    GmshClient *getGmshClient(){ return _gmshClient; }
     virtual bool isNetworkClient(){ return true; }
     virtual bool set(number &p, bool value=true){ return _set(p); }
     virtual bool set(string &p, bool value=true){ return _set(p); }
diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp
index dd2bb166a6ed7b0ef79170edce3a7c888bf6ba1e..7ffc64f3c4dd7b28a90cf1d57739c0ccbd947e87 100644
--- a/Fltk/Main.cpp
+++ b/Fltk/Main.cpp
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
 
   // Non-interactive Gmsh
   if(CTX::instance()->batch) {
-    if(!Msg::GetClient()) CTX::instance()->terminal = 1;
+    if(!Msg::GetGmshClient()) CTX::instance()->terminal = 1;
     GmshBatch();
     GmshFinalize();
     Msg::Exit(0);
diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp
index b238e2bb25e2e4494e99470ef90804f1059207fa..39cc74c319be971da69ae858c2615b28e08ae473 100644
--- a/Fltk/menuWindow.cpp
+++ b/Fltk/menuWindow.cpp
@@ -174,7 +174,7 @@ static void file_remote_cb(Fl_Widget *w, void *data)
   }
   else
     c = (onelab::localNetworkClient*)it->second;
-  GmshServer *server = (GmshServer*)c->getServer();
+  GmshServer *server = c->getGmshServer();
   
   std::string str((const char*)data);
 
diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp
index 56549836b3c78295f780e48356442e0972f349b4..5c20460fabb860a5b4027310c6168d3826b3e89b 100644
--- a/Fltk/onelabWindow.cpp
+++ b/Fltk/onelabWindow.cpp
@@ -237,7 +237,6 @@ bool onelab::localNetworkClient::run(const std::string &what)
       Msg::Info("got %d Mb message in %g seconds",
                 length / 1024 / 1024, GetTimeInSeconds() - timer);
       break;
-    /* FIXME PViewDataRemote should store the onelab::localNetworkClient
     case GmshSocket::GMSH_VERTEX_ARRAY:
       {
         int n = PView::list.size();
@@ -246,7 +245,6 @@ bool onelab::localNetworkClient::run(const std::string &what)
         drawContext::global()->draw();
       }
       break;
-    */
     default:
       Msg::Warning("Received unknown message type (%d)", type);
       break;
diff --git a/Post/PViewDataRemote.h b/Post/PViewDataRemote.h
index 371620077485aad968017f05c282395e40134e88..4e9f10c1de63da2ed471f97e635419b129a09e38 100644
--- a/Post/PViewDataRemote.h
+++ b/Post/PViewDataRemote.h
@@ -49,7 +49,7 @@ class PViewDataRemote : public PViewData {
   bool isRemote(){ return true; }
   int fillRemoteVertexArrays(std::string &options)
   {
-    GmshServer *server = (GmshServer*)_remote->getServer();
+    GmshServer *server = _remote->getGmshServer();
     if(!server){
       Msg::Error("Remote server not running: please start server");
       return 1;