Fix a bug in checkPauseOrCancellation with the select invocation