added try/catch to plot()