fixed a bug in the plotting routine.