build: fixed the task counter when nothreads is used