Setting NPC Model - NPC.Entity:SetModel(NPCTable.Model); Gives NULL Entity error

Hi,
I’m currently am in the progress of making a PERP Gamemode(Please don’t kill me) free of any errors, it’s little things like end’s missing here and there, and some old functions i had to rewrite(Updated tmysql for example)

Everything worked well, but i was missing content.
So, i installed all content, making sure i installed the NPC models correctly since every NPC that loaded failed to load, since the NPC model couldn’t be found.
The NPC models were correctly installed, but that gave me this:

http://puu.sh/qGNbj/ce76d0ab15.png

This happends with EVERY NPC that loads.

Here’s my NPC code:



NPC_DATABASE = {};

if SERVER then
	function GM.NPCUsed ( Player, ID )
		umsg.Start("perp_npc_used", Player);
			umsg.Short(ID);
		umsg.End();
	end
	
	function GM:LoadNPC ( NPCTable )
		Msg("	-> Loaded " .. NPCTable.Name .. " [ID: " .. NPCTable.ID .. "]
");
		
		local locationsTable = NPCTable.Location;
		local anglesTable = NPCTable.Angles;
		
		if (type(locationsTable) != "table") then locationsTable = {locationsTable}; end
		if (type(anglesTable) != "table") then anglesTable = {anglesTable}; end
		
		if (#locationsTable != #anglesTable) then
			Msg("		Warning: Locations and angles tables not the same size.
");
		end
		
		NPCTable.NPCs = {};
		
		for k, v in pairs(locationsTable) do
			if (anglesTable[k]) then
				local NPC = ents.Create("npc_vendor");
				NPC.Entity:SetModel(NPCTable.Model); -- The line in question which is being a pain in the butt.
				NPC.NPCID = NPCTable.ID;
				NPC:SetPos(v);
				NPC:SetAngles(anglesTable[k]);
				
				if (NPCTable.Invisible) then
					NPC:SetColor(Color(255, 255, 255, 0));
					NPC:SetNoDraw(true)
				else
					NPC:SetColor(Color(255, 255, 255, 255));
				end;
				
				if NPCTable.ShowChatBubble == "Normal" then
					NPC:MakeChatBubble();
				elseif NPCTable.ShowChatBubble == "VIP" then
					NPC:MakeVIPChatBubble();
				end;
				
				NPC:Spawn();
				
				NPC:InitializeAnimation(NPCTable.Sequence);
				
				table.insert(NPCTable.NPCs, NPC);
			end
		end
		
		NPC_DATABASE[NPCTable.ID] = NPCTable;
	end
	
	function PLAYER:NearNPC ( NPCID )
		for k, v in pairs(ents.FindByClass("npc_vendor")) do
			if (v.NPCID == NPCID) then
				if (self:GetPos():Distance(v:GetPos()) < 500) then
					return true;
				else
					return false;
				end
			end
		end
		return false;
	end
else
	function GM:LoadNPC ( NPCTable )
		Msg("	-> Loaded " .. NPCTable.Name .. " [ID: " .. NPCTable.ID .. "]
");
		NPC_DATABASE[NPCTable.ID] = NPCTable;
	end
	
	local function NPCUsed ( UMsg )
		local ID = UMsg:ReadShort();
		
		local NearestNPC;
		local NearestPos = 9999;
		for k, v in pairs(ents.FindByClass("npc_vendor")) do
			local Dist = v:GetPos():Distance(LocalPlayer():GetPos());
			if (Dist < NearestPos) then
				NearestPos = Dist;
				NearestNPC = v;
			end
		end		
		NPC_DATABASE[ID].OnTalk(LocalPlayer());
	end
	usermessage.Hook("perp_npc_used", NPCUsed);
end




I’ve tried changing: “NPC.Entity:SetModel(NPCTable.Model);”
To the following:
NPC:Setmodel(NPCTable.Model);
Entity:SetModel

Hope sombody can help.
Thanks in advance