fixed the cum_sum bug

cum_sum itself is not a problem. The bad access problem occurs when the
sum is NaN. This is because the weight after the exp is way too small.