fix NPE in tests
Merge pull request #997 from LorenzoBoccaccia/master

fix NPE in tests