modified logic on adding / to end of links