fix indexing issue