fix error pages and redirect