quit and restart handling