port of PR #8038