diff --git a/README.md b/README.md
index 0e79121608b641514b7a928e43b64f8ae159a064..851405f567dc0adea442152c483eef17c285c95e 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+<!--THIS FILE HAS BEEN GENERATED BY A SCRIPT. PLEASE DON'T CHANGE IT MANUALLY.-->
+
 # Welcome
 
 This is the **CaosDB Python Client Library** repository and a part of the
diff --git a/src/caosdb/common/administration.py b/src/caosdb/common/administration.py
index 2852c5c040404337f6f670670f96105280887177..98687e3c25286121decb499e233aa0743eff47a8 100644
--- a/src/caosdb/common/administration.py
+++ b/src/caosdb/common/administration.py
@@ -219,6 +219,7 @@ def _delete_role(name, **kwargs):
 
 def _set_roles(username, roles, realm=None, **kwargs):
     xml = etree.Element("Roles")
+    print(roles)
     for r in roles:
         xml.append(etree.Element("Role", name=r))
 
@@ -254,8 +255,9 @@ def _get_roles(username, realm=None, **kwargs):
         e.msg = "User does not exist."
         raise
     ret = set()
-    for r in etree.fromstring(body)[0]:
-        ret.add(r.get("name"))
+    for r in etree.fromstring(body).xpath('/Response/Roles')[0]:
+        if r.tag == "Role":
+            ret.add(r.get("name"))
     return ret
 
 
@@ -316,11 +318,12 @@ class PermissionRule():
         xml = etree.fromstring(body)
         ret = set()
         for c in xml:
-            ret.add(PermissionRule._parse_element(c))
+            if c.tag in ["Grant", "Deny"]:
+                ret.add(PermissionRule._parse_element(c))
         return ret
 
     def __str__(self):
-        return self._action + "(" + self._permission + ")" + \
+        return str(self._action) + "(" + str(self._permission) + ")" + \
             ("P" if self._priority is True else "")
 
     def __repr__(self):
diff --git a/src/caosdb/exceptions.py b/src/caosdb/exceptions.py
index a5d6e99662c38e6f74e2e974a68ce8152997e271..45c4570b4227031a35a486b86ea65535ff105852 100644
--- a/src/caosdb/exceptions.py
+++ b/src/caosdb/exceptions.py
@@ -70,9 +70,10 @@ class ClientErrorException(CaosDBException):
 class ServerErrorException(CaosDBException):
     def __init__(self, body):
         xml = etree.fromstring(body)
-        msg = xml[0].get("description")
-        if xml[0].text is not None:
-            msg = msg + "\n\n" + xml[0].text
+        error = xml.xpath('/Response/Error')[0]
+        msg = error.get("description")
+        if error.text is not None:
+            msg = msg + "\n\n" + error.text
         CaosDBException.__init__(self, msg)