Fixing ordering of 2d array