Fixed template bug that affected graphs using multiple targets