Fixed broken binary search when hunting for the correct scope