fixing indexing issues