Fix #1343
(cherry picked from commit 0c0f2587f3c446d40bb6fe84b75f07bb2ef846bd)