Fix stable_partition() to be actually stable