diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt
index 8742f1ce5fa4cbe0f27ed2b29510e10cfa415be4..282e7218e8a37c50b7905fb648298bfd003f761b 100644
--- a/Common/CMakeLists.txt
+++ b/Common/CMakeLists.txt
@@ -24,6 +24,7 @@ set(SRC
   onelabUtils.cpp
   GamePad.cpp
   GmshRemote.cpp
+  GmshAPI.cpp
 )
 
 if(ENABLE_ONELAB AND NOT ENABLE_ONELAB2)
diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp
index 9d4504f66a0762043662b79def39b34fdb4c9fbb..92583faa858110be16807d1c44c5bf8d6b38b180 100644
--- a/Geo/GModelIO_OCC.cpp
+++ b/Geo/GModelIO_OCC.cpp
@@ -1941,15 +1941,16 @@ bool OCC_Internals::_extrude(int mode,
   _multiBind(result, -1, outDimTags, true, true);
 
   // return entities in the same order as the built-in kernel extrusion
-  if(dim >= 1 && dim <= 3 && top.size() == inDimTags.size() &&
-     top.size() == body.size() && top.size() == lateral.size()){
+  if(dim >= 1 && dim <= 3 &&
+     top.size() == inDimTags.size() && top.size() == body.size()){
     outDimTags.clear();
     for(unsigned int i = 0; i < top.size(); i++){
       if(_isBound(dim - 1, top[i]))
         outDimTags.push_back(std::pair<int, int>(dim - 1, _find(dim - 1, top[i])));
       if(_isBound(dim, body[i]))
         outDimTags.push_back(std::pair<int, int>(dim, _find(dim, body[i])));
-      if(CTX::instance()->geom.extrudeReturnLateral){
+      if(CTX::instance()->geom.extrudeReturnLateral &&
+         top.size() == lateral.size()){
         for(unsigned int j = 0; j < lateral[i].size(); j++){
           if(_isBound(dim - 1, lateral[i][j]))
             outDimTags.push_back