fixed recursive binary search