Merge pull request #49 from ajjohnston/master

Avoiding NullReference Exceptions.
Merge remote-tracking branch 'upstream/master'