update match() function