tweak class matching algo