diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index a165770..ea9008d 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -1,14 +1,17 @@
+// @ts-expect-error
+import type { HaikuClient } from "jshaiku";
+import type { Guild, GuildAuditLogsEntry } from 'discord.js';
 import { callback as statsChannelUpdate } from "../reflex/statsChannelUpdate.js";
 
 export const event = "guildUpdate";
 
-export async function callback(client, before, after) {
-    await statsChannelUpdate(client, after.me);
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = after.client.logger;
+export async function callback(client: HaikuClient, before: Guild, after: Guild) {
+    await statsChannelUpdate(client, after.me!);
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
     const auditLog = await getAuditLog(after, "GUILD_UPDATE");
-    const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
+    const audit = auditLog.entries.filter((entry: GuildAuditLogsEntry) => entry.target!.id === after.id).first();
     if (audit.executor.id === client.user.id) return;
-    const list = {};
+    const list: Record<string, ReturnType<typeof entry>> = {};
 
     const verificationLevels = {
         NONE: "Unrestricted",
@@ -28,32 +31,34 @@
         NONE: "None",
         ELEVATED: "Enabled"
     };
+    const beforeOwner = await before.fetchOwner()
+    const afterOwner = await after.fetchOwner()
 
-    if (before.name !== after.name) list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+    if (before.name !== after.name) list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
     if (before.icon !== after.icon)
-        list.icon = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
+        list["icon"] = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
     if (before.splash !== after.splash)
-        list.splash = entry(
+        list["splash"] = entry(
             [before.splash, after.splash],
             `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`
         );
     if (before.banner !== after.banner)
-        list.banner = entry(
+        list["banner"] = entry(
             [before.banner, after.banner],
             `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`
         );
-    if (before.owner !== after.owner)
-        list.owner = entry(
-            [before.owner, after.owner],
-            `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`
+    if (beforeOwner !== afterOwner)
+        list["owner"] = entry(
+            [beforeOwner, afterOwner],
+            `${renderUser(beforeOwner.user)} -> ${renderUser(afterOwner.user)}`
         );
     if (before.verificationLevel !== after.verificationLevel)
-        list.verificationLevel = entry(
+        list["verificationLevel"] = entry(
             [verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]],
             `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`
         );
     if (before.explicitContentFilter !== after.explicitContentFilter)
-        list.explicitContentFilter = entry(
+        list["explicitContentFilter"] = entry(
             [
                 explicitContentFilterLevels[before.explicitContentFilter],
                 explicitContentFilterLevels[after.explicitContentFilter]
@@ -69,8 +74,8 @@
         );
 
     if (!Object.keys(list).length) return;
-    list.updated = entry(new Date().getTime(), renderDelta(new Date().getTime()));
-    list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
+    list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()));
+    list["updatedBy"] = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
             type: "guildUpdate",
