I'm not against this sleep 2, but I'm wondering - when you call the 'stop' does it return right away before the daemon has actually been stopped, or does the 'stop' not return until its stopped? If its the later (which would be better, if you ask me), then I'm not sure what the point of the sleep here would be.