Fixes issue 4781.
Merge pull request #4782 from zaggino/issue4781

Fixes issue 4781.