fixed bug: graph is drawn once