Fix issues with captured characters and span handing.