partial fix for Issue 5570
Merge pull request #3372 from WalterBright/fix5570

partial fix for Issue 5570