Merge pull request #225 from glyph/right-error

Don't randomly fail with KeyError in shutdown().