fix ui, improve logic for connectivity