Ensure that the fields returned will be sorted before putting them to XML file.