diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index edee2f6d4fc8daa4b0c011ea12a41f83b72cf78a..237a06d4529177a8e1533812a1cbeeb40401d3e5 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -14993,7 +14993,7 @@ int NEWSURFACE(void)
   if(CTX::instance()->geom.oldNewreg)
     tag = NEWREG();
   else
-    tag = GModel::current()->getGEOInternals()->MaxSurfaceNum + 1;
+    tag = GModel::current()->getGEOInternals()->getMaxTag(2) + 1;
   tag = std::max(tag, GModel::current()->getOCCInternals()->getMaxTag(2) + 1);
   return tag;
 }
@@ -15004,7 +15004,7 @@ int NEWSURFACELOOP(void)
   if(CTX::instance()->geom.oldNewreg)
     tag = NEWREG();
   else
-    tag = GModel::current()->getGEOInternals()->MaxSurfaceLoopNum + 1;
+    tag = GModel::current()->getGEOInternals()->getMaxTag(-2) + 1;
   tag = std::max(tag, GModel::current()->getOCCInternals()->getMaxTag(-2) + 1);
   return tag;
 }
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index 02455a80bdd2cd3f3adc4e88e79c59d0db953a0c..64810c2895039171040c990a96c2019d6018a642 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -7277,14 +7277,14 @@ void addEmbedded(int dim, std::vector<int> tags, int dim2, int tag2)
   }
 }
 
-int NEWPOINT(void)
+int NEWPOINT()
 {
   int tag = GModel::current()->getGEOInternals()->getMaxTag(0) + 1;
   tag = std::max(tag, GModel::current()->getOCCInternals()->getMaxTag(0) + 1);
   return tag;
 }
 
-int NEWLINE(void)
+int NEWLINE()
 {
   int tag = 0;
   if(CTX::instance()->geom.oldNewreg)
@@ -7295,7 +7295,7 @@ int NEWLINE(void)
   return tag;
 }
 
-int NEWLINELOOP(void)
+int NEWLINELOOP()
 {
   int tag = 0;
   if(CTX::instance()->geom.oldNewreg)
@@ -7306,29 +7306,29 @@ int NEWLINELOOP(void)
   return tag;
 }
 
-int NEWSURFACE(void)
+int NEWSURFACE()
 {
   int tag = 0;
   if(CTX::instance()->geom.oldNewreg)
     tag = NEWREG();
   else
-    tag = GModel::current()->getGEOInternals()->MaxSurfaceNum + 1;
+    tag = GModel::current()->getGEOInternals()->getMaxTag(2) + 1;
   tag = std::max(tag, GModel::current()->getOCCInternals()->getMaxTag(2) + 1);
   return tag;
 }
 
-int NEWSURFACELOOP(void)
+int NEWSURFACELOOP()
 {
   int tag = 0;
   if(CTX::instance()->geom.oldNewreg)
     tag = NEWREG();
   else
-    tag = GModel::current()->getGEOInternals()->MaxSurfaceLoopNum + 1;
+    tag = GModel::current()->getGEOInternals()->getMaxTag(-2) + 1;
   tag = std::max(tag, GModel::current()->getOCCInternals()->getMaxTag(-2) + 1);
   return tag;
 }
 
-int NEWVOLUME(void)
+int NEWVOLUME()
 {
   int tag = 0;
   if(CTX::instance()->geom.oldNewreg)
@@ -7339,7 +7339,7 @@ int NEWVOLUME(void)
   return tag;
 }
 
-int NEWREG(void)
+int NEWREG()
 {
   int tag = 0;
   tag = GModel::current()->getGEOInternals()->MaxLineNum;
@@ -7354,7 +7354,7 @@ int NEWREG(void)
   return tag;
 }
 
-int NEWFIELD(void)
+int NEWFIELD()
 {
 #if defined(HAVE_MESH)
   return (GModel::current()->getFields()->maxId() + 1);
@@ -7363,7 +7363,7 @@ int NEWFIELD(void)
 #endif
 }
 
-int NEWPHYSICAL(void)
+int NEWPHYSICAL()
 {
   if(CTX::instance()->geom.oldNewreg)
     return NEWREG();
diff --git a/Parser/Parser.h b/Parser/Parser.h
index 1dad3f5b4782ed8be1470cdb2e3fccb21faa7579..676a1a65dd474cd850461f4ffd6f7a172a00bec6 100644
--- a/Parser/Parser.h
+++ b/Parser/Parser.h
@@ -40,14 +40,14 @@ extern std::map<std::string, std::vector<std::string> > gmsh_yystringsymbols;
 
 void PrintParserSymbols(bool help, std::vector<std::string> &vec);
 
-int NEWPOINT(void);
-int NEWLINE(void);
-int NEWLINELOOP(void);
-int NEWSURFACE(void);
-int NEWSURFACELOOP(void);
-int NEWVOLUME(void);
-int NEWREG(void);
-int NEWFIELD(void);
-int NEWPHYSICAL(void);
+int NEWPOINT();
+int NEWLINE();
+int NEWLINELOOP();
+int NEWSURFACE();
+int NEWSURFACELOOP();
+int NEWVOLUME();
+int NEWREG();
+int NEWFIELD();
+int NEWPHYSICAL();
 
 #endif