finish median partition select, fix bug in previous select