Don't lose client state half of the time when reconnecting. Fixes #7