fixed some leakage issues with the plotter