make connected state work, but it's ugly for now