modified the plot scripts to correct a few bugs