Endianness fixes for double array logic