fixed some templating bugs