Fix bug on resize