fix a bug about binary search