move flattenTerm before FreshCondToFreshVar