Fix crashes
Merge pull request #6 from Simon311/master

Fix crashes