Do a better check on shell connection state