                 "output_row"."participation" := NULL;
               END IF;
             END IF;
-            SELECT * INTO "delegation_row" FROM "delegation"
-              WHERE "truster_id" = "output_row"."member_id"
-              AND (
-                "unit_id" = "unit_id_v" OR
-                "area_id" = "area_id_v" OR
-                "issue_id" = "issue_id_p"
-              )
-              ORDER BY "scope" DESC;
+            IF "simulate_here_v" THEN
+              IF "simulate_trustee_id_p" ISNULL THEN
+                SELECT * INTO "delegation_row" FROM "delegation"
+                  WHERE "truster_id" = "output_row"."member_id"
+                  AND (
+                    "unit_id" = "unit_id_v" OR
+                    "area_id" = "area_id_v"
+                  )
+                  ORDER BY "scope" DESC;
+              END IF;
+            ELSE
+              SELECT * INTO "delegation_row" FROM "delegation"
+                WHERE "truster_id" = "output_row"."member_id"
+                AND (
+                  "unit_id" = "unit_id_v" OR
+                  "area_id" = "area_id_v" OR
+                  "issue_id" = "issue_id_p"
+                )
+                ORDER BY "scope" DESC;
+            END IF;
           END IF;
         ELSE
-          "output_row"."member_valid"  := FALSE;
           "output_row"."participation" := FALSE;
-          "output_row"."scope_out"     := NULL;
-          "delegation_row" := ROW(NULL);
         END IF;
-        IF
-          "output_row"."member_id" = "member_id_p" AND
-          "simulate_trustee_id_p" NOTNULL
-        THEN
+        IF "simulate_here_v" AND "simulate_trustee_id_p" NOTNULL THEN
           "output_row"."scope_out" := "scope_v";
           "output_rows" := "output_rows" || "output_row";
           "output_row"."member_id" := "simulate_trustee_id_p";

    "unit_id_p"             "unit"."id"%TYPE,
    "area_id_p"             "area"."id"%TYPE,
    "issue_id_p"            "issue"."id"%TYPE,
    "simulate_trustee_id_p" "member"."id"%TYPE DEFAULT NULL )
  RETURNS SETOF "delegation_chain_row"
  LANGUAGE 'plpgsql' STABLE AS $$
    DECLARE

          "output_row"."overridden" := TRUE;
        END IF;
        "output_row"."scope_in" := "output_row"."scope_out";
        "output_row"."member_valid" := EXISTS (
          SELECT NULL FROM "member" JOIN "privilege"
          ON "privilege"."member_id" = "member"."id"
          AND "privilege"."unit_id" = "unit_id_v"
          WHERE "id" = "output_row"."member_id"
          AND "member"."active" AND "privilege"."voting_right"
        );
        "simulate_here_v" := (
          "simulate_v" AND
          "output_row"."member_id" = "member_id_p"
        );
        "delegation_row" := ROW(NULL);
        IF "output_row"."member_valid" OR "simulate_here_v" THEN
          IF "scope_v" = 'unit' THEN
            IF NOT "simulate_here_v" THEN
              SELECT * INTO "delegation_row" FROM "delegation"
                WHERE "truster_id" = "output_row"."member_id"
                AND "unit_id" = "unit_id_v";
            END IF;
          ELSIF "scope_v" = 'area' THEN
            "output_row"."participation" := EXISTS (
              SELECT NULL FROM "membership"
              WHERE "area_id" = "area_id_p"
              AND "member_id" = "output_row"."member_id"
            );
            IF "simulate_here_v" THEN
              IF "simulate_trustee_id_p" ISNULL THEN
                SELECT * INTO "delegation_row" FROM "delegation"
                  WHERE "truster_id" = "output_row"."member_id"
                  AND "unit_id" = "unit_id_v";
              END IF;
            ELSE
              SELECT * INTO "delegation_row" FROM "delegation"
                WHERE "truster_id" = "output_row"."member_id"
                AND (
                  "unit_id" = "unit_id_v" OR
                  "area_id" = "area_id_v"
                )
                ORDER BY "scope" DESC;
            END IF;
          ELSIF "scope_v" = 'issue' THEN
            IF "issue_row"."fully_frozen" ISNULL THEN
              "output_row"."participation" := EXISTS (
