Small fix for shutdown issues