Fix issue with sorting matches