fixed bug on resize