fixed fit to window logic