Fixed some issues with template vars