Fixed a couple bugs with the template