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