Adding patch from pteague for templates.