Fix reconnection, part I.
Merge branch 'master' of https://github.com/RagingBigFemaleBird/sgs into working