REALLY ugly implementation of order-preservation after failure.