Finally fix the recounting

We do that by taking care of the circular ref-counting.
Basically we keep track of the ref counts after the tag has
been parsed. In case of error it should be 1, if it is on the
lib it should be 2 and everything beyond 2 is a cyclic refcount
So instead of deleting the node when the ref count reaches zero
we do it when it reaches the amount of cyclic refcounts.