fixing bug with terminating client on stop