fix sorted list bug

it was doing a linear search rather than a binary search.