Fix xml file overwrite problem