fix bug on template structure