index was being overwritten