Fixed deletion of template graphs.