Merge pull request #36 from elyas-bhy/issue-28

Fixed NPE during initialization, fixes #28