Fixed incorrect bookkeeping of internal state in TaskExecutor