More general solution for serial number misorders.