fixing binary search