NPE protection
Merge pull request #8 from jbaruch/master

NPE protection