Fixed shutting down and restarting