Better default 404/500 logic