Fixing broken URLs and adding support for 404 (need testing with custom domain)