Fix memory corruption, but leave the merge sort as not part of 2.6