Added more failsafes
Revert "Added more failsafes"

This reverts commit 56c7b8c6dee487cc1a554885263777c0bf07c04b.
Revert "Revert "Added more failsafes""

This reverts commit 464bb3fc2aa90db2801be02969b85d2feed3420b.