Fixed support for cancelling asynchronous operations.
Removed debug code.