Use scoreboardpos instead of rank to sort.