use proper locking for thread safety