Fixed bug in calling cancel.