Fix bug where under some circumstances a textnode got lost after text formatting.