fix bugs in rankAlgorithm and rankSchema