rename device_index to index