fixed match logic