fixed bug on losing window focus