remove change sort to KItem in flattenTermsTwo