Fix for XHR resolving even on error