Fixed defect in calculating order status.