fix to crash on rapidly switching domains