binary-search bug