fix issue #23 null exception.
Merge pull request #24 from pensz/fixissue23

fix issue #23 null exception.