Fix reconnecting (fixes #12)