Faster lower_bound and upper_bound
Fixed bugs in lower and upper bound. Some numerical issues.