improved rest client robustness