Fix for NPE crash (issue #69)

Closes #69