made cancellation handling better