fix #8464

backport of 94093ce161dd662f93659028c8d