issue #842: fix accidental global
issue #842: add test for xhrFields option