fix bug on resize