Reconnect on loss of connection

Fixes #104