Fix bug on resize to get sizes correctly