Fix reconnect handling
Merge pull request #22 from renzihui/master

Fix reconnect handling