Minor fixes to window refresh order