[misc] Bulletproofing

(cherry picked from commit 0131ed495048f8f90d8102a540f006ebb51861e7)