Fixed bug in templates