fixed template bug where wrong result was being rendered.