potential fix for exception on shutdown.