Fixed overflow bug on graph drawing