fix duplication bug with template