Fix count_threads variable check

Seems it never really worked.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>