Add safety checks.