Fix getting rank