diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index 8a1f2a77733e7c8ba1e303e77e553c1596e66b7d..18cb37bcafacbdfba2fca303c9b7e739b199f7db 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -32,7 +32,7 @@ int GmshInitialize(int argc, char **argv)
   // Initialize messages (parallel stuff, etc.)
   Msg::Init(argc, argv);
 
-#if !defined(HAVE_NO_POST)
+#if !defined(HAVE_NO_PARSER)
   // Initialize the symbol tree that will hold variable names in the
   // parser
   InitSymbols();
diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 61ee997bfcfcdf1cf4c9e29c995b80487b806261..fe3e647e8f703693d244a40eeb67088653ee18e8 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -402,6 +402,13 @@ void OpenProject(const char *name)
   for(int i = PView::list.size() - 1; i >= 0; i--)
     if(PView::list[i]->getData()->hasModel(GModel::current()))
       delete PView::list[i];
+#endif
+#if !defined(HAVE_NO_PARSER)
+  // reinitialize the parser symbol tree (only if the current model is
+  // not empty: if it's empty it probably mean we just launched gmsh,
+  // and we don't want to delete variables set e.g. using the -string
+  // command line option)
+  if(GModel::current()->getNumVertices()) InitSymbols();
 #endif
   GModel::current()->destroy();
   GModel::current()->getGEOInternals()->destroy();