A fix to make agent compatible with tornado 2.x and 3.x