diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake
index 8030861694e987c8de9b24c8708ecc1b0bcac627..dd7231fbcd830e208fcaae43fc596f19c4b113ff 100644
--- a/cmake/DD4hep.cmake
+++ b/cmake/DD4hep.cmake
@@ -112,11 +112,12 @@ else()
 endif()
 
   set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX})
-
+message(STATUS "DD4hep_DIR = ${DD4hep_DIR}" )
   add_custom_command(OUTPUT ${rootmapfile}
                      COMMAND ${CMAKE_COMMAND} -Dlibname=${libname} -Drootmapfile=${rootmapfile}
                              -Dgenmap_install_dir=${LIBRARY_OUTPUT_PATH}
                              -DROOT_VERSION_MAJOR=${ROOT_VERSION_MAJOR}
+                             -DDD4hep_DIR=${DD4hep_DIR}
                              -P ${DD4hep_DIR}/cmake/MakeRootMap.cmake
                      DEPENDS ${library})
 
diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index 823139f8bf33cfe0b19bc78132432a5e33dc92c1..37e86396e92c58c12d5acac087d07d727e1c8171 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -15,6 +15,7 @@ cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
 message ( STATUS "INCLUDING DD4hepBuild...." )
 include ( CMakeParseArguments )
 set ( DD4hepBuild_included ON )
+####set ( DD4HEP_DEBUG_CMAKE ON )
 
 #---------------------------------------------------------------------------------------------------
 macro(dd4hep_to_parent_scope val)
@@ -574,7 +575,7 @@ function ( dd4hep_handle_optional_sources tag optionals missing uses sources )
     dd4hep_find_package( ${USE_NAME} pkg_found 
       ARGS ${USE_REQUIRED} ${USE_COMPONENT} ${USE_COMPONENTS} 
       TYPE ${USE_TYPE} )
-    if ( "{pkg_found}" STREQUAL "OFF" )
+    if ( "${pkg_found}" STREQUAL "OFF" )
       dd4hep_print ( "|    ${tag}  ...optional: Skip sources ${USE_SOURCES} [requires ${USE_NAME}]" )
     elseif ( "${pkg_found}" STREQUAL "ON" )
       dd4hep_print ( "|    ${tag}  ...optional: ADD sources ${USE_SOURCES} [dependent on ${USE_NAME}]" )
diff --git a/cmake/MakeRootMap.cmake b/cmake/MakeRootMap.cmake
index 1753b7a307f95b578da5cbe6dfa36d5caaa06ab5..47c6b621b9394b4850f30156c508fe1da54dc3cb 100644
--- a/cmake/MakeRootMap.cmake
+++ b/cmake/MakeRootMap.cmake
@@ -3,7 +3,8 @@ if( ${ROOT_VERSION_MAJOR} GREATER 5 )
   #
   #  Running listcomponents from Gaudi
   #
-  FIND_PROGRAM( ROOT_genmap_CMD listcomponents PATHS ${genmap_install_dir}/../bin )
+  FIND_PROGRAM( ROOT_genmap_CMD listcomponents PATHS ${genmap_install_dir}/../bin ${DD4hep_DIR}/bin )
+  ###MESSAGE( STATUS " *** MakeROOTMap ${genmap_install_dir}/../bin $ENV{DD4hep_DIR}/bin ${DD4hep_DIR}" )
   MESSAGE( STATUS " *** MakeROOTMap[components].cmake run command : ${ROOT_genmap_CMD} -o ${rootmapfile} ${libname} 
                  WORKING_DIRECTORY ${genmap_install_dir} "
     )  
@@ -23,7 +24,6 @@ else()
   #  Running genmap from ROOT 5
   #
   FIND_PROGRAM( ROOT_genmap_CMD genmap PATHS $ENV{ROOTSYS}/bin $ENV{PATH} )
-
   MESSAGE( STATUS " *** MakeROOTMap.cmake run command : ${ROOT_genmap_CMD} -debug -i ${libname} -o ${rootmapfile}
                  WORKING_DIRECTORY ${genmap_install_dir} "
     )
diff --git a/cmake/thisdd4hep.sh b/cmake/thisdd4hep.sh
index 3db3902afcbe6fefe5b567c7b96598381d12f34a..6095e76a77d893844ae1206726665e19a8447b1c 100644
--- a/cmake/thisdd4hep.sh
+++ b/cmake/thisdd4hep.sh
@@ -73,7 +73,7 @@ ROOTENV_INIT=${ROOTSYS}/bin/thisroot.sh;
 test -r ${ROOTENV_INIT} && { cd $(dirname ${ROOTENV_INIT}); . ./$(basename ${ROOTENV_INIT}) ; cd $OLDPWD ; }
 #
 #----Geant4 LIBRARY_PATH------------------------------------------------------
-if [ ${Geant4_DIR ]; then
+if [ ${Geant4_DIR} ]; then
     G4LIB_DIR=`dirname ${Geant4_DIR}`;
     export G4INSTALL=`dirname ${G4LIB_DIR}`;
     export G4ENV_INIT=${G4INSTALL}/bin/geant4.sh
@@ -82,14 +82,14 @@ if [ ${Geant4_DIR ]; then
     #---- if geant4 was built with external CLHEP we have to extend the dynamic search path
     if [ @GEANT4_USE_CLHEP@ ] ; then
 	dd4hep_add_library_path @CLHEP_LIBRARY_PATH@;
-    fi
+    fi;
     dd4hep_add_library_path ${G4LIB_DIR};
     unset G4ENV_INIT;
     unset G4LIB_DIR;
-fi
+fi;
 #
 #----XercesC LIBRARY_PATH-----------------------------------------------------
-if test [ $XERCESCINSTALL ]; then
+if [ ${XERCESCINSTALL} ]; then
     #dd4hep_add_path    PATH ${XERCESCINSTALL}/bin;
     dd4hep_add_library_path ${XERCESCINSTALL}/lib;
 fi;