fixes results matching and sorting