fixing NPE
Merge pull request #180 from raghavgautam/master

fixing NPE