Fixes NPE with #34
Merge pull request #36 from dazappa/master

Null pointer exception fix for #34