fix undefined method `nil' error
Merge pull request #433 from kunalp/master

fix undefined method `nil' error