reorder to keep relative ordering the same