Fixed issues #5 (losing IP on reconnect) and #19 (TLS bug)