simplify the mutex handling