this is needed because previous plots are not properly cleaned up. I'm not sure if that's the best way to do it, though.