re-write mutex lock.