Use explicit for looping order.
Fix shitty logarithm error.
Fix wrong offset read.
Update test and tuple start index.
Remove useless array size.