bugfix on templates generation