Fix bug on page resize