Add test_order_events and fix code