Fixed sorting bug.

Introduced in c251f600da54b2bde8c91545ca9e5415820fc21e.