fixes to indexing