Fixing issue with indexing