Store array length in the array root node rather than the last element (fix #351 #361)