binary search corrected