Fix NPE.
Merge pull request #120 from romainreuillon/NPE

Fix a NPE