Add safety checks