Bugfixes in XML parsing