Hopefully improve the shutdown code