fixing the ranking calculation problem