better logic on matching labels