Fix error when creating templates