fix some bugs of drawing line