Improve xhr lib