self execute when window is ready