refine binarySearch