better window size handling