changed a lock-unlock to lock_guard