[misc] Bulletproofing

(cherry picked from commit 6a8d7091662697bc4b341a9512fca1f0715ad3d3)