make btrsort() work more reliably