Binsearch for error