Fix bug in binary search
fix newline
add some debug stats