Threads getting stuck