added auto reconnect