diff --git a/DDCore/src/parsers/GrammarsV2.h b/DDCore/src/parsers/GrammarsV2.h
index d0b85de926be48fb660ff170b9edfeb3941492d5..5342418e0aee65948683f9df808e7fe7a981b4a6 100644
--- a/DDCore/src/parsers/GrammarsV2.h
+++ b/DDCore/src/parsers/GrammarsV2.h
@@ -31,10 +31,11 @@
 // Boost:
 //==============================================================================
 #ifdef __GNUC__
+#define __DD4HEP_LOCAL_GNUC__ __GNUC__
 #undef __GNUC__
 // Boost spits out an error if __GNUC__ is defined!
 #include <boost/spirit/include/qi.hpp>
-#define __GNUC__
+#define __GNUC__ __DD4HEP_LOCAL_GNUC__
 #else
 #include <boost/spirit/include/qi.hpp>
 #endif
diff --git a/DDDB/src/DDDBAlignmentTest.cpp b/DDDB/src/DDDBAlignmentTest.cpp
index ed27c921489abc2cde116dbb953080e64f44f274..4bc23ffa66400789aeee337d442d781a9329ded7 100644
--- a/DDDB/src/DDDBAlignmentTest.cpp
+++ b/DDDB/src/DDDBAlignmentTest.cpp
@@ -68,7 +68,9 @@ namespace  {
     int det_key, par_key, top;
   };
   struct UserData {
-    typedef std::map<std::string,size_t>       DetectorMap;
+    static bool det_lexical_ordering(DetElement a, DetElement b)
+    {    return std::less(a.path(), b.path());                }
+    typedef std::map<DetElement,size_t,det_lexical_ordering>       DetectorMap;
     typedef std::map<unsigned int,size_t>      DetectorKeys;
     typedef std::vector<Entry>                 Entries;
     DetectorMap  detectors;
@@ -89,7 +91,7 @@ namespace  {
         entry.par  = det.parent().ptr();
         entry.det_key = key;
         entry.par_key = det.parent().key();
-        data.detectors.insert(make_pair(det.path(),data.entries.size()));
+        data.detectors.insert(make_pair(det,data.entries.size()));
         data.keys.insert(make_pair(key,data.entries.size()));
         data.entries.insert(data.entries.end(),entry);
       }
@@ -271,7 +273,7 @@ namespace  {
         Entry& e = data.entries[(*i).second];
         DetElement    det = e.det;
         unsigned int  key = det.key();
-        const string& p   = (*i).first;
+        const string& p   = det.path();
         size_t idx = p.find(prev);
         if ( idx == 0 )  {
           //printout(INFO,"Conditions","***** %d %p %08X: %s ",
diff --git a/DDG4/include/DDG4/IoStreams.h b/DDG4/include/DDG4/IoStreams.h
index 2d1ce26be2e629762904f08cf1464f03c6671105..1c779ca5b28c79eec20267a42fc1aee48f84c523 100644
--- a/DDG4/include/DDG4/IoStreams.h
+++ b/DDG4/include/DDG4/IoStreams.h
@@ -22,21 +22,22 @@
 #pragma GCC diagnostic ignored "-Wshadow" // Code that causes warning goes here
 #endif
 
+// booost iostreams include files
+#include <boost/iostreams/categories.hpp>
+#include <boost/iostreams/detail/ios.hpp>
+#include <boost/iostreams/detail/path.hpp>
+#include <boost/iostreams/positioning.hpp>
+
 #ifdef __GNUC__
-#undef __GNUC__
 // Boost spits out an error if __GNUC__ is defined!
+#define __DD4HEP_LOCAL_GNUC__ __GNUC__
+#undef __GNUC__
 #include <boost/iostreams/stream.hpp>
-#define __GNUC__
+#define __GNUC__ __DD4HEP_LOCAL_GNUC__
 #else
 #include <boost/iostreams/stream.hpp>
 #endif
 
-// booost iostreams include files
-#include <boost/iostreams/categories.hpp>
-#include <boost/iostreams/detail/ios.hpp>
-#include <boost/iostreams/detail/path.hpp>
-#include <boost/iostreams/positioning.hpp>
-
 // Forward declarations
 class TFile;