better handling for 500 and 404 errors