Correcting shutdown logic.