improvements to the fix for #3114

keep the tstate consistent and a better test
2 files changed