Improved 404 handling