diff --git a/buildDataMan.sh b/buildDataMan.sh
index d629be60a9760fe40e599e863b59d300dc3ab3b5..930c932fac50bed2ed0b236deefd96b96cfeb085 100755
--- a/buildDataMan.sh
+++ b/buildDataMan.sh
@@ -6,18 +6,25 @@
 #     Author: wfg
 
 DATAMAN_LOCATION=/home/wfg/Applications/DataMan
+MPICOMPILER=mpic++
+
+if [ "$(uname)" == "Darwin" ]; then
+	CCOMPILER=g++-6        
+elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
+	CCOMPILER=g++
+fi
 echo "######################################################################################"
 echo "Start building ADIOS ./lib/libadios.a ./libadios_nompi.a with DataMan library" 
 echo "######################################################################################"
 echo
-make HAVE_DATAMAN=yes DATAMAN_LOC=$DATAMAN_LOCATION       #build the ./lib/libadios.a and ./libadios_nompi.a
+make HAVE_DATAMAN=yes DATAMAN_LOC=$DATAMAN_LOCATION CC=$CCOMPILER MPICC=$MPICOMPILER       #build the ./lib/libadios.a and ./libadios_nompi.a
 echo
 echo "#################################################################"
 echo "Building Dataman Reader and Writer examples"
 echo "#################################################################"
-make -C ./examples/hello/datamanWriter HAVE_DATAMAN=yes DATAMAN_LOC=$DATAMAN_LOCATION
+make -C ./examples/hello/datamanWriter HAVE_DATAMAN=yes DATAMAN_LOC=$DATAMAN_LOCATION CC=$CCOMPILER MPICC=$MPICOMPILER
 echo
-make -C ./examples/hello/datamanReader HAVE_DATAMAN=yes DATAMAN_LOC=$DATAMAN_LOCATION
+make -C ./examples/hello/datamanReader HAVE_DATAMAN=yes DATAMAN_LOC=$DATAMAN_LOCATION CC=$CCOMPILER MPICC=$MPICOMPILER
 
 echo
 echo
diff --git a/examples/hello/datamanReader/Makefile b/examples/hello/datamanReader/Makefile
index bf33bdcab7a2e9acdd2e3ed64a6e205ed07366ca..57af50503903f01d9f8d8533f2bbe7c52d8320bb 100644
--- a/examples/hello/datamanReader/Makefile
+++ b/examples/hello/datamanReader/Makefile
@@ -20,8 +20,8 @@ INC+= -I$(ADIOS_DIR)/include
 #DATAMAN
 DATAMAN_LOC=/home/wfg/Applications/DataMan
 INC+= -I$(DATAMAN_LOC)/include
-LIB+= -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman
-LIB_NOMPI+= -L$(DATAMAN_LOC)/lib -ldataman
+LIB+= -Wl,-rpath=$(DATAMAN_LOC)/lib -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman
+LIB_NOMPI+= -Wl,-rpath=$(DATAMAN_LOC)/lib -L$(DATAMAN_LOC)/lib -ldataman
 
 #COMPILER FLAGS
 CFLAGS=-Wall -O0 -g -Wpedantic -std=c++11
diff --git a/examples/hello/datamanWriter/Makefile b/examples/hello/datamanWriter/Makefile
index 195afdfbf9c5c294e6d48bb403c0bc7770cc23c8..df793b9b6eeb22d2651f5144bdfc8cf7dc4ead58 100644
--- a/examples/hello/datamanWriter/Makefile
+++ b/examples/hello/datamanWriter/Makefile
@@ -20,8 +20,8 @@ INC+= -I$(ADIOS_DIR)/include
 #DATAMAN
 DATAMAN_LOC=/home/wfg/Applications/DataMan
 INC+= -I$(DATAMAN_LOC)/include
-LIB+= -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman
-LIB_NOMPI+= -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman
+LIB+= -Wl,-rpath=$(DATAMAN_LOC)/lib -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman
+LIB_NOMPI+= -Wl,-rpath=$(DATAMAN_LOC)/lib -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman
 
 #COMPILER FLAGS
 CFLAGS=-Wall -O0 -g -Wpedantic -std=c++11
diff --git a/include/engine/bp/BPWriter.h b/include/engine/bp/BPWriter.h
index ce99908c675250dff927ed9f82024563195ba946..6e1c822674a1f920fe84e5faf1c17fef90d8f429 100644
--- a/include/engine/bp/BPWriter.h
+++ b/include/engine/bp/BPWriter.h
@@ -74,6 +74,10 @@ public:
 
     void AdvanceStep( );
 
+    /**
+     * Closes a single transport or all transports
+     * @param transportIndex, if -1 (default) closes all transports, otherwise it closes a transport in m_Transport[transportIndex]. In debug mode the latter is bounds-checked.
+     */
     void Close( const int transportIndex = -1 );
 
 private:
@@ -81,7 +85,7 @@ private:
     capsule::STLVector m_Buffer; ///< heap capsule using STL std::vector<char>
     std::size_t m_BufferVariableCountPosition = 0; ///< needs to be updated in every advance step
     bool m_IsFirstClose = true; ///< set to false after first Close is reached so metadata doesn't have to be accommodated for a subsequent Close
-    std::size_t m_MaxBufferSize;
+    std::size_t m_MaxBufferSize; ///< maximum allowed memory to be allocated
     float m_GrowthFactor = 1.5; ///< capsule memory growth factor, new_memory = m_GrowthFactor * current_memory
 
     format::BP1Writer m_BP1Writer; ///< format object will provide the required BP functionality to be applied on m_Buffer and m_Transports
diff --git a/src/engine/bp/BPWriter.cpp b/src/engine/bp/BPWriter.cpp
index ad6c7de2f2749cbdd4e13e9d3bdda17140b77d09..ff3f65960e3dfd70d9df45753c1ffbc5ddf41604 100644
--- a/src/engine/bp/BPWriter.cpp
+++ b/src/engine/bp/BPWriter.cpp
@@ -177,19 +177,6 @@ void BPWriter::Close( const int transportIndex )
     {
         m_BP1Writer.Close( m_MetadataSet, m_Buffer, *m_Transports[transportIndex], m_IsFirstClose );
     }
-
-    //BP1Writer to update the metadata indices
-
-
-
-    //merge all metadata indices in capsule.m_Metadata buffer or capsule.m_Data buffer (depends on transport predefined functionality)
-
-
-    //BP1BPWriter to write to corresponding transport
-
-
-
-    //Close the corresponding transport
 }
 
 
diff --git a/src/format/BP1Writer.cpp b/src/format/BP1Writer.cpp
index 59eb3a1263dd76132f72c3a5ad5b4a10cae92bc7..fbbd68c3dac422ca3dc10fc770eece3230169604 100644
--- a/src/format/BP1Writer.cpp
+++ b/src/format/BP1Writer.cpp
@@ -253,7 +253,7 @@ void BP1Writer::FlattenMetadata( BP1MetadataSet& metadataSet, Capsule& capsule )
     const std::uint64_t offsetPGIndex = capsule.m_DataAbsolutePosition;
     const std::uint64_t offsetVarsIndex = offsetPGIndex + pgLength;
     const std::uint64_t offsetAttributeIndex = offsetVarsIndex + varsIndexLength;
-    std::size_t position = attributesIndexLength;
+    std::size_t position = pgLength + varsIndexLength + attributesIndexLength;
 
     //offsets
     std::memcpy( &metadata[position], &offsetPGIndex, 8 );