Fix bug on window resize.