resolves some issues connected to automatic reconnect (#8)