correct a bug when there is an error with orders