fix indexing from the beginning