bug fixes in ranking