diff --git a/aleksis/apps/untis/util/mysql/importers/absences.py b/aleksis/apps/untis/util/mysql/importers/absences.py
index 9d5e4e7d7e45bc3a0e13a7744597381c5a6bf1b2..48ad3950ce55f444036ce192bfb22fa437385c16 100644
--- a/aleksis/apps/untis/util/mysql/importers/absences.py
+++ b/aleksis/apps/untis/util/mysql/importers/absences.py
@@ -183,5 +183,6 @@ def import_absences(
         if a.import_ref_untis and a.import_ref_untis not in existing_absences:
             logger.info("Absence {} deleted".format(a.id))
             a.delete()
+            LessonSubstitution.objects.filter(absence_ref_untis=a.import_ref_untis).delete()
 
     return ref, created_substitutions
diff --git a/aleksis/apps/untis/util/mysql/importers/lessons.py b/aleksis/apps/untis/util/mysql/importers/lessons.py
index 7f73ef77caa71eb224b63eda31049022fd28c2f5..14420f4994a76d94d9491b828cb2b09ec64c8063 100644
--- a/aleksis/apps/untis/util/mysql/importers/lessons.py
+++ b/aleksis/apps/untis/util/mysql/importers/lessons.py
@@ -128,46 +128,49 @@ def import_lessons(
                 qs = core_models.Group.objects.filter(
                     parent_groups__in=[c.id for c in course_classes],
                     subject_id=subject.id,
-                    owners__in=[t.id for t in teachers],
                 ).filter(Q(school_term__isnull=True) | Q(school_term=validity_range.school_term))
 
+                if not qs.exists():
+                    logger.warning("    Not matching course group not found")
+
                 # Check if found groups match
+                possible_groups = []
                 course_group = None
                 for found_group in qs:
                     if compare_m2m(course_classes, found_group.parent_groups.all()) and compare_m2m(
                         teachers, found_group.owners.all()
                     ):
-                        course_group = found_group
-                        logger.info(
-                            "    Course group found by searching by parent groups, "
-                            "teachers (owners) and subject"
-                        )
+                        possible_groups.append(found_group)
+
+                if len(possible_groups) == 1:
+                    course_group = possible_groups[0]
+                    logger.info("    Course group found by searching by parent groups, and subject")
+                else:
+                    for found_group in possible_groups:
+                        if compare_m2m(teachers, found_group.owners.all()):
+                            course_group = found_group
+                            logger.info(
+                                "    Course group found by searching by parent groups, "
+                                "teachers (owners) and subject"
+                            )
 
                 if (
                     not course_group
                     and get_site_preferences()["untis_mysql__course_groups_fuzzy_matching"]
                 ):
+                    qs = qs.filter(owners__in=[t.id for t in teachers])
                     if qs.count() != 1:
                         logger.warning(
-                            "    Course group not found by searching by parent groups, "
+                            "    Course group not found or more than one found "
+                            "by searching by parent groups, "
                             "teachers (owners) and subject (fuzzy matching mode)"
                         )
                     else:
-                        for found_group in qs:
-                            if compare_m2m(teachers, found_group.owners.all()):
-                                if course_group:
-                                    logger.warning(
-                                        "    More than one course group found "
-                                        "by searching by parent groups, "
-                                        "teachers (owners) and subject (fuzzy matching mode)"
-                                    )
-                                    course_group = None
-                                else:
-                                    course_group = found_group
-                                    logger.info(
-                                        "    Course group found by searching by parent groups, "
-                                        "teachers (owners) and subject (fuzzy matching mode)"
-                                    )
+                        course_group = qs.first()
+                        logger.info(
+                            "    Course group found by searching by parent groups, "
+                            "teachers (owners) and subject (fuzzy matching mode)"
+                        )
 
                 changed = False
                 register_data_check = get_site_preferences()[