corrected mutex/condition variable code