added support for text nodes, fix card count