fixed bugs and problems with quicksort