added check for plotting