properly handle window size changes