Looks like it was `distinct: true` that was screwing up the associated sorting.