Fixed infinite loop on resize.