Fixing a few crashes
Merge pull request #430 from mozilla/crash-fixes

Fixing a few crashes