corrected indexing by id as it breaks things