Fixed a bug where empty text nodes could be added