fixed re-order logic