fixed binary search issues