Minor bug fix on the operation of cancel.