add reconnect logic