Fixed a bug in templates.