Add MutexLock to gurantee thread safety