fix up sorting