Fixed calculation bug for pie charts