fixed a terrible bug in the plotting code!