Fix null and undefined res.
Merge pull request #695 from bootstraponline/master

Fix #693