Fix terminata condition for msort.