handle XHR errors more gracefully