fix bug of ranking/unranking