Improve cookiejar and networkmanager implementation.