Fix bug on 3D array access