move template render to output phase