Replace shutdown function.