Fixing issue when stoping the service.