Nullref fixes
Merge pull request #78 from ckhamash/master

Nullref fixes