Fixes #7010

fixes the issue #7010.