Fixed bugs in plotter