Fix several client bugs.