Fix an error on shutdown.