diff --git a/system/checkStudenten.php b/system/checkStudenten.php
index 12bad24b8..171cdd690 100644
--- a/system/checkStudenten.php
+++ b/system/checkStudenten.php
@@ -609,7 +609,7 @@ $text .= "
Studierender hat keine Matrikelnummer
";
$qry = "
SELECT
- distinct on (person_id)
+ distinct on (tbl_person.person_id)
tbl_student.student_uid,
tbl_prestudent.prestudent_id,
tbl_prestudent.studiengang_kz as studiengang
@@ -618,7 +618,7 @@ FROM
JOIN public.tbl_prestudentstatus USING(prestudent_id)
JOIN public.tbl_person USING(person_id)
JOIN public.tbl_student USING(prestudent_id)
- JOIN public.tbl_benutzer USING(person_id)
+ JOIN public.tbl_benutzer ON(tbl_student.student_uid=tbl_benutzer.uid)
WHERE
status_kurzbz in('Student', 'Diplomand', 'Absolvent', 'Abbrecher')
AND tbl_prestudent.bismelden
diff --git a/vilesci/bis/checkverwendung.php b/vilesci/bis/checkverwendung.php
index a843d41c6..faf0e500e 100644
--- a/vilesci/bis/checkverwendung.php
+++ b/vilesci/bis/checkverwendung.php
@@ -241,6 +241,7 @@ $qryall='
JOIN bis.tbl_bisverwendung ON (uid=mitarbeiter_uid)
WHERE
aktiv=false
+ and bismelden=true
AND (ende>now() OR ende IS NULL)
GROUP BY uid, nachname, vorname
ORDER by nachname, vorname;';