Fix bug in templeates