add check for null
Merge pull request #166 from jgho/nullCheck

add check for null