Fix potential fatal error when fetching orders via API