move flattenTerms before StrictnessToContexts