Simple Prop Damage Fix request

Simple Prop Damage

This was a really useful code. Which it works still, but has a very high chance of breaking. Could anyone possibly take a look at it?

Error:
Hook ‘spdEntityTakeDamage’ Failed: autorun/server/spd.lua:51: bad argument #1 to ‘SetStart’ (Vector expected, got no value)


 if !ConVarExists("spd") then CreateConVar("spd", '0', FCVAR_NOTIFY) end  
 if !ConVarExists("spd_fire") then CreateConVar("spd_fire", '2', FCVAR_NOTIFY) end  
   
 local function SPD_Main_Dmg_Hook(ent, inflictor, attacker, amount)  
     local con_spd_val = GetConVarNumber("spd") --Since we only need to call it once and we are going to use the val twice...  
     --There is a reason for the order of operations  
     --We don't call the function unless we have too (and therefore avoid a useless overhead)  
     if ent and ent.IsValid and (con_spd_val > 0) and ent:IsValid() then  
         if not ent.SPD_Data then ent.SPD_Data = {} end  
           
         --The reason this is in 2 steps is that I don't want short cut evaluation biting us in the ass  
         --Because both the value nil and the value false equates to false in a boolean check  
         if ent.SPD_Data.Invalid then   
             return  
         elseif (ent.SPD_Data.Invalid == nil) and (not (ent:GetClass() ~= "prop_physics" or ent:Health() == 0)) then   
             ent.SPD_Data.Invalid = true  
             return  
         else  
             ent.SPD_Data.Invalid = false  
         end  
   
         if not ent.SPD_Data.Health then ent.SPD_Data.Health = ent:GetPhysicsObject():GetMass() end  
           
         local e_pos = ent:GetPos()  
         local mass = ent:GetPhysicsObject():GetMass()  
         local colmod = ent.SPD_Data.Health / mass  
           
         ent.SPD_Data.Health = ent.SPD_Data.Health - amount / con_spd_val  
         ent:SetColor(255, 255 * colmod, 255 * colmod, 255)  
   
   
         if math.random(1, 100) < GetConVarNumber("spd_fire") then  
             ent:Ignite(10, 20)  
         end  
   
         if ent.SPD_Data.Health < (mass * 0.5) then  
             ent:GetPhysicsObject():EnableMotion(true)  
         end  
   
         if (ent.SPD_Data.Health < (mass * 0.25)) and ent:IsConstrained() then  
             local effect = EffectData()  
             effect:SetStart(e_pos)  
             effect:SetOrigin(e_pos + Vector(0, 0, 10))  
             effect:SetScale(mass)  
             util.Effect("cball_explode", effect)  
             constraint.RemoveAll(ent)  
         end 
         
         if ent.SPD_Data.Health < 0 then  
             local effect = EffectData()  
             effect:SetStart()  
             effect:SetOrigin(e_pos + Vector(0, 0, 10))  
             effect:SetScale(mass)  
             util.Effect("Explosion", effect)  
             ent:Remove()
         end  
     end  
 end  
 hook.Add("EntityTakeDamage", "spdEntityTakeDamage", SPD_Main_Dmg_Hook)