Fixed some issues in templates