diff --git a/game/engines/default/engine/Map.lua b/game/engines/default/engine/Map.lua
index 1a023587317d8c92aa82edc438f83a89d04c6932..74f64bcc3d2542babd3f7254fad08a3d5dc8438a 100644
--- a/game/engines/default/engine/Map.lua
+++ b/game/engines/default/engine/Map.lua
@@ -946,7 +946,7 @@ function _M:processEffects()
 			for ly, _ in pairs(ys) do
 				local act = game.level.map(lx, ly, engine.Map.ACTOR)
 				if act and act == e.src and not ((type(e.selffire) == "number" and rng.percent(e.selffire)) or (type(e.selffire) ~= "number" and e.selffire)) then
-				elseif act and e.src and e.src.reactionToward and (e.src:reactionToward(act) >= 0) and not ((type(e.friendlyfire) == "number" and rng.percent(typ.friendlyfire)) or (type(e.friendlyfire) ~= "number" and e.friendlyfire)) then
+				elseif act and e.src and e.src.reactionToward and (e.src:reactionToward(act) >= 0) and not ((type(e.friendlyfire) == "number" and rng.percent(e.friendlyfire)) or (type(e.friendlyfire) ~= "number" and e.friendlyfire)) then
 				-- Otherwise hit
 				else
 					DamageType:get(e.damtype).projector(e.src, lx, ly, e.damtype, e.dam)
diff --git a/game/engines/default/engine/interface/ActorTalents.lua b/game/engines/default/engine/interface/ActorTalents.lua
index 8068c4ba5b12a2487e4863f026f81129d1ec568c..8c8dbc6313213ed9a1657d9f275cfb18bb97932b 100644
--- a/game/engines/default/engine/interface/ActorTalents.lua
+++ b/game/engines/default/engine/interface/ActorTalents.lua
@@ -291,9 +291,10 @@ function _M:learnTalent(t_id, force, nb)
 		end
 	end
 
-	self.talents[t_id] = (self.talents[t_id] or 0) + (nb or 1)
-
-	if t.on_learn then for i = 1, (nb or 1) do t.on_learn(self, t) end end
+	for i = 1, (nb or 1) do 
+		self.talents[t_id] = (self.talents[t_id] or 0) + 1
+		if t.on_learn then t.on_learn(self, t) end
+	end
 
 	self.changed = true
 	return true