fix bugs in pie chart ordering