fixed binary search error