improve link handling