updated version, to support proxy and https