fix to crash on rapidly switching domains
Merge pull request #3930 from ZappoMan/crashOnSwitch

fix to crash on rapidly switching domains