diff --git a/game/engines/default/engine/interface/ActorInventory.lua b/game/engines/default/engine/interface/ActorInventory.lua
index d8c9e0cd192e5085b1c600211e29439d2fdd4231..14f5af430f0be38b27be572d6245426aa8827c5e 100644
--- a/game/engines/default/engine/interface/ActorInventory.lua
+++ b/game/engines/default/engine/interface/ActorInventory.lua
@@ -92,12 +92,7 @@ end
 --- Adds an object to an inventory
 -- @return false if the object could not be added otherwise true and the inventory index where it is now
 function _M:addObject(inven_id, o)
-	local inven
-	if type(inven_id) == "number" then
-		inven = self.inven[inven_id]
-	else
-		inven = inven_id
-	end
+	local inven = self:getInven(inven_id)
 
 	-- No room ?
 	if #inven >= inven.max then return false end
@@ -168,7 +163,7 @@ end
 -- @param no_unstack if the item was a stack takes off the whole stack if true
 -- @return the object removed or nil if no item existed and a boolean saying if there is no more objects
 function _M:removeObject(inven, item, no_unstack)
-	if type(inven) == "number" then inven = self.inven[inven] end
+	local inven = self:getInven(inven)
 
 	if not inven[item] then return false, true end
 
diff --git a/game/modules/tome/data/general/objects/gem.lua b/game/modules/tome/data/general/objects/gem.lua
index d13e4e9b778539ce8742673a23e8326db9dfe50e..961828d955704adc7fd7e94de44cce13a7019052 100644
--- a/game/modules/tome/data/general/objects/gem.lua
+++ b/game/modules/tome/data/general/objects/gem.lua
@@ -42,7 +42,7 @@ local colors_attacks = {
 
 local function newGem(name, image, cost, rarity, color, min_level, max_level, tier, power, imbue, bomb)
 	-- Gems, randomly lootable
-	newEntity{ base = "BASE_GEM", define_as = "GEM_"..name:upper(),
+	newEntity{ base = "BASE_GEM", define_as = "GEM_"..name:gsub(" ", "_"):upper(),
 		name = name:lower(), subtype = color,
 		color = colors[color:upper()], image=image,
 		level_range = {min_level, max_level},
diff --git a/game/modules/tome/dialogs/debug/DebugMain.lua b/game/modules/tome/dialogs/debug/DebugMain.lua
index 8c46f9ab0b5172fb672d812da03c10e7e0dc52c9..beb81234b37f460cb40cdf1ddaabbc9a5d899f7e 100644
--- a/game/modules/tome/dialogs/debug/DebugMain.lua
+++ b/game/modules/tome/dialogs/debug/DebugMain.lua
@@ -133,6 +133,15 @@ function _M:use(item)
 		end
 	elseif act == "all-ingredients" then
 		game.party:giveAllIngredients(100)
+		-- Gems count too
+		for def, od in pairs(game.zone.object_list) do
+			if type(def) == "string" and not od.unique and od.rarity and def:find("^GEM_") then
+				local o = game.zone:finishEntity(game.level, "object", od)
+				o:identify(true)
+				game.player:addObject("INVEN", o)
+				game.player:sortInven()
+			end
+		end
 	else
 		self:triggerHook{"DebugMain:use", act=act}
 	end