add client and fix bugs