Fixed some bugs in the graph rendering code