fix bugs in generating team ranking