removed bugs on templates