add isconnected check