Better support for shutdown event