Prevent some undefined method on nil errors
Merge pull request #138 from tsujigiri/undef_on_nil

Prevent some undefined method on nil errors