Fixed some minor bugs in the templates