Fix some bugs in service client and shutdown process.