[client] Fix bugs and improve debug message.