Fix some problems in the plot scripts