adding error checking for visualizer