fixed error in indexing