Add nil check
Merge pull request #13 from ymrl/add_nil_check

Add nil check