fix bug in unregisterClient