  <icatdump>
  """)
          self.outfile.write(etree.tostring(head, pretty_print=True))
-@@ -164,5 +164,5 @@
+@@ -162,7 +162,7 @@
      def finalize(self):
          """Finalize the dump file."""
          self.startdata()
 -        self.outfile.write(b"</icatdump>\n")
 +        self.outfile.write("</icatdump>\n")
          self.outfile.close()
+ 
+ 
 Index: icat/dumpfile_yaml.py
 ===================================================================
---- icat/dumpfile_yaml.py	(revision 349)
+--- icat/dumpfile_yaml.py	(revision 522)
 +++ icat/dumpfile_yaml.py	(working copy)
-@@ -96,8 +96,8 @@
-         elif attr in obj.InstMRel:
-             if mreltypes is None:
-                 info = client.getEntityInfo(obj.BeanName)
--                mreltypes = { f.name:insttypemap[f.type] 
--                              for f in info.fields if f.relType == "MANY" }
-+                mreltypes = dict([ (f.name,insttypemap[f.type]) 
-+                                   for f in info.fields if f.relType == "MANY" ])
-             for rd in d[attr]:
-                 robj = dict2entity(client, insttypemap, 
-                                    rd, mreltypes[attr], objindex)
-@@ -118,8 +118,8 @@
+@@ -131,8 +131,8 @@
+ 
      def __init__(self, client, infile):
-         self.client = client
-         self.infile = infile
+         super(YAMLDumpFileReader, self).__init__(client, infile)
 -        self.insttypemap = { c.BeanName:t 
 -                             for t,c in self.client.typemap.iteritems() }
 +        self.insttypemap = dict([ (c.BeanName,t) 

 
     def getdata(self):
         """Iterate over the data chunks in the dump file.
@@ -140,7 +140,7 @@
         etree.SubElement(head, "apiversion").text = apiversion
         etree.SubElement(head, "generator").text = ("icatdump (python-icat %s)" 
                                                     % icat.__version__)
-        self.outfile.write(b"""<?xml version="1.0" encoding="utf-8"?>

     pass
Index: icat/dumpfile_xml.py
===================================================================
--- icat/dumpfile_xml.py	(revision 522)
+++ icat/dumpfile_xml.py	(working copy)
@@ -93,8 +93,8 @@
         super(XMLDumpFileReader, self).__init__(client, infile)
         # need binary mode for infile
         self.infile = os.fdopen(os.dup(infile.fileno()), 'rb')
-        self.insttypemap = { c.BeanName:t 
