fix cancellation point implementation