ensure ordering by rank