fix a lock problem
(cherry picked from commit 11e8b3c9484f9e495e0c9becd055aa8d1047bfc1)