Fix bug in template