Added a few checks on window resize, fixes #32