diff --git a/src/mesh.jl b/src/mesh.jl
index e0a5ab771a1dbb57294a7ca8e2ed992086b021c0..4a6f576d8bb46eda751a79c22201f8ec11faa45b 100644
--- a/src/mesh.jl
+++ b/src/mesh.jl
@@ -287,7 +287,7 @@ function refine!(hmesh::HMesh, marked_cells::Set; fs...)
     end
     # prolong data for refined cells
     for (old_cell, extended_cells) in refined_cells
-	for (f, extended_f) in zip(NamedTuple(fs), extended_fs)
+	for extended_f in extended_fs
 	    prolong!(extended_f, old_cell, extended_cells)
 	end
     end
@@ -343,9 +343,12 @@ function prolong!(new_f, old_cell, new_cells, ::P1)
 
     avg_data = (old_f.data[old_gdofs[:, 1]] .+ old_f.data[old_gdofs[:, 2]]) ./ 2
 
-    new_gdofs = new_f.space.dofmap[:, 3, new_cells[1]]
+    _, newldof = findmax(new_cell1_vs)
+    new_gdofs = new_f.space.dofmap[:, newldof, new_cells[1]]
     new_f.data[new_gdofs] .= avg_data
-    new_gdofs = new_f.space.dofmap[:, 3, new_cells[2]]
+
+    _, newldof = findmax(new_cell2_vs)
+    new_gdofs = new_f.space.dofmap[:, newldof, new_cells[2]]
     new_f.data[new_gdofs] .= avg_data
 end