Some templating fixes