Fixing indexing errors.