fixed 2d sorting