diff --git a/package.json b/package.json
index 9d3df42..629c6dd 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
     "dependencies": {
         "@hokify/agenda": "^6.2.12",
-        "@tensorflow/tfjs": "^4.0.0",
+        "@tensorflow/tfjs": "^3.18.0",
         "@tensorflow/tfjs-node": "^4.2.0",
         "@total-typescript/ts-reset": "^0.3.7",
         "@tsconfig/node18-strictest-esm": "^1.0.0",
@@ -21,7 +21,7 @@
         "mongodb": "^4.7.0",
         "node-fetch": "^3.3.0",
         "node-tesseract-ocr": "^2.2.1",
-        "nsfwjs": "https://github.com/infinitered/nsfwjs",
+        "nsfwjs": "^2.4.2",
         "seedrandom": "^3.0.5",
         "structured-clone": "^0.2.2",
         "systeminformation": "^5.17.3"
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index ca60b2c..e719f22 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -2,7 +2,7 @@
 import client from "../utils/client.js";
 import keyValueList from "../utils/generateKeyValueList.js";
 import singleNotify from "../utils/singleNotify.js";
-import { streamAttachment } from "../reflex/scanners.js";
+import { saveAttachment } from "../reflex/scanners.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import addPlural from "../utils/plurals.js";
 import type { GuildTextBasedChannel, Message } from "discord.js";
@@ -14,7 +14,7 @@
     const attachments = [];
     for (const attachment of message.attachments.values()) {
         attachments.push({
-            local: (await streamAttachment(attachment.url))[0],
+            local: (await saveAttachment(attachment.url))[0],
             url: attachment.url,
             height: attachment.height,
             width: attachment.width,
@@ -25,7 +25,7 @@
     for (const link of links) {
         if (link.toLowerCase().match(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/gi)) {
             attachments.push({
-                local: (await streamAttachment(link))[0],
+                local: (await saveAttachment(link))[0],
                 url: link,
                 height: null,
                 width: null
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index fb1a436..53c8c9b 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -1,13 +1,13 @@
 import fetch from "node-fetch";
-import fs, { writeFileSync, createReadStream } from "fs";
+import { writeFileSync } from "fs";
 import generateFileName from "../utils/temp/generateFileName.js";
 import Tesseract from "node-tesseract-ocr";
 import type Discord from "discord.js";
 import client from "../utils/client.js";
 import { createHash } from "crypto";
-import * as nsfwjs from "nsfwjs/src";
-import * as clamscan from "clamscan";
-import * as tf from "@tensorflow/tfjs-node";
+import * as nsfwjs from "nsfwjs";
+// import * as clamscan from "clamscan";
+import * as tf from "@tensorflow/tfjs";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
@@ -28,7 +28,7 @@
     const alreadyHaveCheck = await client.database.scanCache.read(hash);
     if (alreadyHaveCheck?.nsfw) return { nsfw: alreadyHaveCheck.nsfw };
 
-    const image = tf.node.decodeImage(new Uint8Array(fileStream), 3) as tf.Tensor3D;
+    const image = tf.tensor3d(new Uint8Array(fileStream));
 
     const predictions = (await nsfw_model.classify(image, 1))[0]!;
     image.dispose();
@@ -37,32 +37,32 @@
 }
 
 export async function testMalware(link: string): Promise<MalwareSchema> {
-    const [p, hash] = await streamAttachment(link);
+    const [_, hash] = await saveAttachment(link);
     const alreadyHaveCheck = await client.database.scanCache.read(hash);
     if (alreadyHaveCheck?.malware) return { safe: alreadyHaveCheck.malware };
     return { safe: true };
-    const data = new URLSearchParams();
-    // const f = createReadStream(p);
-    data.append("file", f.read(fs.statSync(p).size));
-    const result = await fetch("https://unscan.p.rapidapi.com/malware", {
-        method: "POST",
-        headers: {
-            "X-RapidAPI-Key": client.config.rapidApiKey,
-            "X-RapidAPI-Host": "unscan.p.rapidapi.com"
-        },
-        body: data
-    })
-        .then((response) =>
-            response.status === 200 ? (response.json() as Promise<MalwareSchema>) : { safe: true, errored: true }
-        )
-        .catch((err) => {
-            console.error(err);
-            return { safe: true, errored: true };
-        });
-    if (!result.errored) {
-        client.database.scanCache.write(hash, "malware", result.safe);
-    }
-    return { safe: result.safe };
+    // const data = new URLSearchParams();
+    // // const f = createReadStream(p);
+    // data.append("file", f.read(fs.statSync(p).size));
+    // const result = await fetch("https://unscan.p.rapidapi.com/malware", {
+    //     method: "POST",
+    //     headers: {
+    //         "X-RapidAPI-Key": client.config.rapidApiKey,
+    //         "X-RapidAPI-Host": "unscan.p.rapidapi.com"
+    //     },
+    //     body: data
+    // })
+    //     .then((response) =>
+    //         response.status === 200 ? (response.json() as Promise<MalwareSchema>) : { safe: true, errored: true }
+    //     )
+    //     .catch((err) => {
+    //         console.error(err);
+    //         return { safe: true, errored: true };
+    //     });
+    // if (!result.errored) {
+    //     client.database.scanCache.write(hash, "malware", result.safe);
+    // }
+    // return { safe: result.safe };
 }
 
 export async function testLink(link: string): Promise<{ safe: boolean; tags: string[] }> {
@@ -90,10 +90,16 @@
 
 export async function streamAttachment(link: string): Promise<[ArrayBuffer, string]> {
     const image = await (await fetch(link)).arrayBuffer();
+    const enc = new TextDecoder("utf-8");
+    return [image, createHash("sha512").update(enc.decode(image), "base64").digest("base64")];
+}
+
+export async function saveAttachment(link: string): Promise<[string, string]> {
+    const image = await (await fetch(link)).arrayBuffer();
     const fileName = generateFileName(link.split("/").pop()!.split(".").pop()!);
     const enc = new TextDecoder("utf-8");
     writeFileSync(fileName, new DataView(image), "base64");
-    return [image, createHash("sha512").update(enc.decode(image), "base64").digest("base64")];
+    return [fileName, createHash("sha512").update(enc.decode(image), "base64").digest("base64")];
 }
 
 const linkTypes = {
