remove dead ends