Fix some issues with the window position code.