Fixed several minor bugs in client.py.