Fix Element#attributes array not being updated correctly after removals.