handle null response
res is sometimes null
Merge pull request #28 from richorama/master

Check for null response (in res)