update the generating method of template