 		/** Heightfield of spans (width*height). Setter. */
 		public function setSpan(index:int, value:RCSpan):void {
 			
-			CModule.write32(CModule.read32(ptr + OFFSET_SPANS) + 4 * index, value.ptr);
+			copyBytes(value.ptr, CModule.read32(ptr + OFFSET_SPANS) + RCSpan.SIZE * index, RCSpan.SIZE);
 			
 		}
 		

		public function getSpan(index:int, resultSpan:RCSpan = null):RCSpan {
			
			if (resultSpan == null) resultSpan = new RCSpan();
			resultSpan.ptr = CModule.read32(CModule.read32(ptr + OFFSET_SPANS) + 4 * index);
			return resultSpan;
			
		}

	
	import recastnavigation.core.RNBase;
	import recastnavigation.core.rn_internal;
	import recastnavigation.core.utils.copyBytes;
	import recastnavigation.internal_api.CModule;
	import recastnavigation.internal_api.internal_rcAllocHeightfield;
	import recastnavigation.internal_api.internal_rcCreateHeightfield;
