Quick bugfix to graph generation function