fix nth_element