fix sort array expansion