fixing addInjection and move flattenTerms before addStreamCell
fixing addInjection and move flattenTerms before addStreamCell