binary search fix