Fixed error on resize