Fixed use of threads