Got rid of crash in shutdown