window focus fix
fix refactoring bugs