Bug in template rendering