fixing parsing of match input / construction of links