Fix segfaults
Merge pull request #1 from SimonSickle/patch-1

Fix segfaults