fix calculation of percentage