Fixed NPE during initialization, fixes #28