better disconnect handling