fixed updatePlot so it removes old line before plotting a new one