Fix Some crashes
Merge pull request #2 from jules2689/fix-crashes

Fix Some crashes