Fix up sorting