Fixed issues with templating