fix issue #255 - cancel a pending operation only if there is an operation pending