Fix Segfaults

Credit @SimonSickle
Merge pull request #1 from jmztaylor/patch-1

Fix Segfaults