Fixing shutdown race condition.