fix rank bug