Ugly fix to the shutdown problem.