Code Review: Extend lock scope for appending.