Handle duplicate tags correctly.