move flattenTerms before ResolveBinder (back)