improve shutdown a bit