adds safeguards
Merge commit '393f3f76beefaa1db75b10f1497ec16d5fd34b0d'