Max point on a line

fix bugs