move flattenTerms back before AddTopCellConfig
move flattenTerms back before AddTopCellConfig