something wrong with my multithread logic