Fix #3820 (cherry picked from commit c9f38e2813)
c9f38e2813
(cherry picked from commit 7b47cb43c1)
7b47cb43c1
(cherry picked from commit ed9dd0e62a)
ed9dd0e62a