fixed bug in quick select algorithm