Fixes #87
Added NPE guard
Merge pull request #94 from g-ortuno/small-improvements

Fixes #87