correct bug on template generation