fixed some rank logic