[client]:fix some bugs and refactoring