[misc] Bulletproofing

(cherry picked from commit 4931b3fd53d8ea8c8b4c2d60861beddf547ebbc2)