merge from upstream. auto xhr version support