diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index c5fd3583e14ec08664bac1cd6d14738e167ab29f..154ec26849484a5d0bd8919c76c66e73377ca198 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -12,6 +12,7 @@ Unreleased
 Fixed
 ~~~~~
 
+* Matching for groups while importing lessons was broken in some cases.
 * Import commands `current_next` and `current_future` imported all terms.
 
 `2.2`_ - 2022-04-10
diff --git a/aleksis/apps/untis/util/mysql/importers/lessons.py b/aleksis/apps/untis/util/mysql/importers/lessons.py
index 006fc497f3b57920e12237da04196912b2cc2abb..bfdfc602b23e833f23b29fe76bc102fcb4b2c529 100644
--- a/aleksis/apps/untis/util/mysql/importers/lessons.py
+++ b/aleksis/apps/untis/util/mysql/importers/lessons.py
@@ -139,7 +139,6 @@ def import_lessons(
                     if compare_m2m(course_classes, found_group.parent_groups.all()) and compare_m2m(
                         teachers, found_group.owners.all()
                     ):
-                        match = True
                         course_group = found_group
                         logger.info(
                             "    Course group found by searching by parent groups, "
@@ -147,7 +146,7 @@ def import_lessons(
                         )
 
                 if (
-                    not match
+                    not course_group
                     and get_site_preferences()["untis_mysql__course_groups_fuzzy_matching"]
                 ):
                     if qs.count() != 1:
@@ -158,16 +157,14 @@ def import_lessons(
                     else:
                         for found_group in qs:
                             if compare_m2m(teachers, found_group.owners.all()):
-                                if match:
+                                if course_group:
                                     logger.warning(
                                         "    More than one course group found "
                                         "by searching by parent groups, "
                                         "teachers (owners) and subject (fuzzy matching mode)"
                                     )
-                                    match = False
                                     course_group = None
                                 else:
-                                    match = True
                                     course_group = found_group
                                     logger.info(
                                         "    Course group found by searching by parent groups, "