fix bug with drawing graph