fixes to binarySearch