modify reconnect logic