Add plot error check