fixed indexing on I/O cells to be more general