diff --git a/dirt.lua b/dirt.lua
index f31a8f05520807a84dd4a158048119a3d72b4416..11d0570cc61d05f389aa1c61ac29d313a92bf670 100644
--- a/dirt.lua
+++ b/dirt.lua
@@ -63,20 +63,17 @@ minetest.register_abm({
 	action = function(pos, node)
 		local count_grasses = {}
 		local curr_max  = 0
-		local curr_type = "ethereal:green_dirt_top" -- fallback Colour
+		local curr_type = "ethereal:green_dirt" -- fallback
 		local positions = minetest.find_nodes_in_area(
 			{x=(pos.x-2), y=(pos.y-2), z=(pos.z-2)},
 			{x=(pos.x+2), y=(pos.y+2), z=(pos.z+2)},
 			"group:ethereal_grass")
+		local n
 		-- count new grass nodes
 		for _,p in ipairs(positions) do
-			local n = minetest.get_node(p)
+			n = minetest.get_node_or_nil(p)
 			if n and n.name then
-				if not count_grasses[n.name] then
-					count_grasses[n.name] = 1
-				else
-					count_grasses[n.name] = count_grasses[n.name] + 1
-				end
+				count_grasses[n.name] = (count_grasses[n.name] or 0) + 1
 				-- we found a grass type with more than current max
 				if count_grasses[n.name] > curr_max then
 					curr_max = count_grasses[n.name]