fixed function for matches