check for and remove invalid anchors