bug fix for mutex and cond