[4.2] bug fix— Fixes #5222

Fixes issue #5222