Trying to deal with XMLHttpRequest Errors