fixed: error in array sorting