fix infinite loop in delete_order