Fix nested tags in insertSpans