fix & test for pull 2299 regression
Merge pull request #2313 from WalterBright/fix-pull-2299

fix & test for pull 2299 regression