Fixed the NPE when primaryMember is null

fixes #117