update template function.