fix line from points bug and deal with undefined cases