Fix bugs in start/stop service discovery