Fix side effect with ‘externals’ argument in  ‘match’ function.