fix passing of threads