Improve handling of proxy settings