Improve resetXMLFile and recoverXMLFile