move flattenTerms before FreezeUserFreezers