made shutdown safe