added tag tree re-build logic