Fixes bug with template