diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm
index 051223d6fe4..5d80030337c 100644
--- a/code/game/machinery/autolathe.dm
+++ b/code/game/machinery/autolathe.dm
@@ -102,6 +102,7 @@
//Build list of multipliers for sheets.
if(R.is_stack)
if(max_sheets && max_sheets > 0)
+ max_sheets = min(max_sheets, R.max_stack) // Limit to the max allowed by stack type.
multiplier_string += "
"
for(var/i = 5;i\[x[i]\]"
diff --git a/code/game/machinery/autolathe_datums.dm b/code/game/machinery/autolathe_datums.dm
index 4506854ed0d..4736096c1cf 100644
--- a/code/game/machinery/autolathe_datums.dm
+++ b/code/game/machinery/autolathe_datums.dm
@@ -16,7 +16,10 @@
recipe.resources = list()
for(var/material in I.matter)
recipe.resources[material] = I.matter[material]*1.25 // More expensive to produce than they are to recycle.
- qdel(I)
+ if(recipe.is_stack && istype(I, /obj/item/stack))
+ var/obj/item/stack/IS = I
+ recipe.max_stack = IS.max_amount
+ qdel(I)
/datum/autolathe/recipe
var/name = "object"
@@ -26,6 +29,7 @@
var/category
var/power_use = 0
var/is_stack
+ var/max_stack
/datum/autolathe/recipe/bucket
name = "bucket"