Fixed bug in binary search algorith,