added special case for 3d array order