fixed window variables initialization bug