fix opt crash when taking multiple consecutive sum.