Fixed potential infinite loop during startup and stop of service

As discussed on the mailing list, the pull request to get the infinite loop fixed.
Hope Dru is happy now =)

Have a nice weekend
Christian