Merge "Fix potential race condition due to missing lock"