Fix a bug with multiple detected devices.