fix bugs in client