Fixed fatal loop rank bug