Null reference fixes.
Merge pull request #55 from jlaanstra/dev

Null reference fixes.