Fixed some hidden bugs in graph.js