fix error in get_broken_tag()
code cleanup