debug the buggy quick sort