fixed binary search

Fixed small bugs with `where` and `findWhere` and the erroneous tests
which didn't catch these issues.