Fix broken tests caused by mutating immutable collections.