Fixing the resize window function