fixing match compare function