Fix null and undefined res.