Fixed a shutdown crash