Bug fix to XML parsing