diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index ee9a99dbf8a0d00a1cc073b75e21b8e7f33e5225..63e7f43256f02f18ec00968192930fa946492663 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -206,12 +206,12 @@ package SLUB::LZA::SIPBuilderBagIt;
             }
             my $recordData = $xp->findnodes_as_string('/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*');
             if (!$recordData) { croak("ERROR: Did not get any <recordData/> for PPN '$ppn' using '$sru'");}
-            my $marcblob = $parser->parse_string($recordData);
+            my $marc_doc = $parser->parse_string($recordData);
             if ($with_debug) {
                 say "write DEBUG_${ppn}_extracted_marc_record.xml";
-                SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_extracted_marc_record.xml", $marcblob);
+                SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_extracted_marc_record.xml", $marc_doc);
             }
-            return $marcblob;
+            return $marc_doc->serialize();
         }
         else {
             carp("Problem asking catalogue at $url using $ppn");