bug fix in xml_cleanup