Backport of PR #305 to 4.4