Fixes shutdown.