better handle canceling condition