Updated #ensure_safe to catch Exception.