bug fix in less & less equal for bsearch
refactor of bsearch