Fixed the templates to work with custom pages.