fixed race condition between template compiling and start to draw the graph