various fixes in templates and page generation