Fix match-adding code