fix bug in calculation of cumulative percentage