diff --git a/mods/default/functions.lua b/mods/default/functions.lua
index fe553c516eea3393f34cada05759b82c9962a390..be1a4cf8f50f1474ce918387226b2045e2984d07 100644
--- a/mods/default/functions.lua
+++ b/mods/default/functions.lua
@@ -309,7 +309,7 @@ minetest.register_abm({
 		end
 		if not do_preserve then
 			-- Drop stuff other than the node itself
-			itemstacks = minetest.get_node_drops(n0.name)
+			local itemstacks = minetest.get_node_drops(n0.name)
 			for _, itemname in ipairs(itemstacks) do
 				if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
 						itemname ~= n0.name then
diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua
index 3466191da47c2f28aecf8390d27f0bc07bf74b56..68a3989b36d4394fc030e6f0d20561ba9abbbf30 100644
--- a/mods/default/nodes.lua
+++ b/mods/default/nodes.lua
@@ -393,19 +393,19 @@ minetest.register_node("default:bookshelf", {
 	groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
 	sounds = default.node_sound_wood_defaults(),
 	on_construct = function(pos)
-		local meta = minetest.env:get_meta(pos)
+		local meta = minetest.get_meta(pos)
 		meta:set_string("formspec", default.bookshelf_formspec)
 		local inv = meta:get_inventory()
 		inv:set_size("books", 8*2)
 	end,
 	can_dig = function(pos,player)
-		local meta = minetest.env:get_meta(pos);
+		local meta = minetest.get_meta(pos);
 		local inv = meta:get_inventory()
 		return inv:is_empty("books")
 	end,
 
 	allow_metadata_inventory_put = function(pos, listname, index, stack, player)
-		local meta = minetest.env:get_meta(pos)
+		local meta = minetest.get_meta(pos)
 		local inv = meta:get_inventory()
 		if listname == "books" then
 			if stack:get_name() == "default:book" then
@@ -417,7 +417,7 @@ minetest.register_node("default:bookshelf", {
 	end,
 
 	allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
-		local meta = minetest.env:get_meta(pos)
+		local meta = minetest.get_meta(pos)
 		local inv = meta:get_inventory()
 		local stack = inv:get_stack(from_list, from_index)
 		local to_stack = inv:get_stack(to_list, to_index)
diff --git a/mods/doors/init.lua b/mods/doors/init.lua
index 808f5f7d3b15f6a3189c894f37ebc171580b43d5..c82de236622783e298696b1c77ec911dde578630 100644
--- a/mods/doors/init.lua
+++ b/mods/doors/init.lua
@@ -380,18 +380,17 @@ local function punch(pos)
 	local me = minetest.get_node(pos)
 	local tmp_node
 	local tmp_node2
-	oben = {x=pos.x, y=pos.y+1, z=pos.z}
-		if state == 1 then
-			state = 0
-			minetest.sound_play("door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
-			tmp_node = {name="doors:trapdoor", param1=me.param1, param2=me.param2}
-		else
-			state = 1
-			minetest.sound_play("door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
-			tmp_node = {name="doors:trapdoor_open", param1=me.param1, param2=me.param2}
-		end
-		update_door(pos, tmp_node)
-		meta:set_int("state", state)
+	if state == 1 then
+		state = 0
+		minetest.sound_play("door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
+		tmp_node = {name="doors:trapdoor", param1=me.param1, param2=me.param2}
+	else
+		state = 1
+		minetest.sound_play("door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
+		tmp_node = {name="doors:trapdoor_open", param1=me.param1, param2=me.param2}
+	end
+	update_door(pos, tmp_node)
+	meta:set_int("state", state)
 end
 
 minetest.register_node("doors:trapdoor", {
diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua
index ba7aed47c6c5e951b88e1307968f3c2cf1e632c1..a36e43e425fb0bf5efde193c62871a20ab3ae8d5 100644
--- a/mods/farming/nodes.lua
+++ b/mods/farming/nodes.lua
@@ -106,8 +106,8 @@ minetest.register_abm({
 			return
 		end
 		-- check if there is water nearby
+		local wet_lvl = minetest.get_item_group(node.name, "wet")
 		if minetest.find_node_near(pos, 3, {"group:water"}) then
-			local wet_lvl = minetest.get_item_group(node.name, "wet")
 			-- if it is dry soil and not base node, turn it into wet soil
 			if wet_lvl == 0 then
 				minetest.set_node(pos, {name = wet})
diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua
index 20f77c014b0d538773cd179822b29d55adf96c9c..590086b4ef218f6f28bc967ecaf65e010a4283ed 100644
--- a/mods/sethome/init.lua
+++ b/mods/sethome/init.lua
@@ -30,7 +30,7 @@ minetest.register_chatcommand("home", {
     description = "Teleport you to your home point",
     privs = {home=true},
     func = function(name)
-        local player = minetest.env:get_player_by_name(name)
+        local player = minetest.get_player_by_name(name)
         if player == nil then
             -- just a check to prevent the server crashing
             return false
@@ -48,7 +48,7 @@ minetest.register_chatcommand("sethome", {
     description = "Set your home point",
     privs = {home=true},
     func = function(name)
-        local player = minetest.env:get_player_by_name(name)
+        local player = minetest.get_player_by_name(name)
         local pos = player:getpos()
         homepos[player:get_player_name()] = pos
         minetest.chat_send_player(name, "Home set!")