Fixing array sort