Fix crashing on textnode substitutions