move flattenTerms before addSymbolicK step