Bugfix for cleanly stopping service