fix cluster rank calculation