put flattenTerms before ResolveBinder