Fix #58: Check for the case where a text node was not added before processing a tail node.