improved http wrapper