fixed templating to properly return htmlElement