Fixed accidental global variables in doXHR function.