Added disconnect check