Fix order number determination when there are no orders