Fix graph drawing code