Fixed Bugs In Line Plotting Algorithm