more corrections to bdn_sort