fixed mutex deadlock bug