Fix handling of the FLAGS argument in `fold-matches'.