overflow problems for binary search