Bug: fix indexing