Don't crash when screen orientation is changed; fixes #1