fixed a recursive summation bug

Signed-off-by: Nicholas Tan Jerome <nicholas.jerome@kit.edu>