Handle undefined properly
Merge pull request #1 from timshadel/master

Handle undefined