Fix null ref
Merge pull request #310 from gcastre/master

Fix null ref