Minnor changes in the cpp code, but fixed a bug in the graph viewer