fix bug in client.py; add auto reconnecting when connection disconnected.