added array sort to avoid getting fail on id order