modify quick sort partition method