Fix expanding tree elements when there's no device.