correct mutex lock/unlock