fix for issue #4413

resubmit PR #4627 

fixes #4413