fix line drawing and canvas redrawing