fixing small bug in link handling