diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index d217e3d19544b52cf2d237e5aa73da365f381c91..5d99a916c8521a00cc25d521121b7c0c67a94e39 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -222,7 +222,7 @@ package SLUB::LZA::SIPBuilderBagIt;
     }
 
     sub add_marc21_schema_location($) {
-        if(! defined $_[0]) { croak "marc xml document required!"; }
+        if(ref($_[0]) ne 'XML::LibXML::Document') { croak "marc xml document required!"; }
         my $marc_doc = $_[0];
         my $root = $marc_doc->findnodes('/*[local-name()="record"]')->[0]; # get root element (XML::LibXML::Element)
         $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); # add xsi namespace (simple)