Switched to a more robust approach for setting custom UserAgent