Fix c-s-d not shutting down cleanly