Small bug fix for templates