improved link handling