added NaN test for cumulative_sum