Fixed a bug in template